VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_ClientControl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'Generated by IDL2VB v120. Copyright (c) 1999 Martin.Both
'Source File Name: ../demos/callback/client.idl
'Target File Name: c_ClientControl.cls

Option Explicit

Implements cOrbAbstractBase
Implements cOrbObject

'interface ::Client::Control
Const sTypeId As String = "IDL:Client/Control:1.0"
Private oObjRef As cOrbObjRef

'Helper to get different COM interface
Friend Function thisOrbAbstractBase() As cOrbAbstractBase
    Set thisOrbAbstractBase = Me
End Function

'Helper
Private Function cOrbAbstractBase_isObjRef() As Boolean
    cOrbAbstractBase_isObjRef = True
End Function

'Helper to get different COM interface
Friend Function thisOrbObject() As cOrbObject
    Set thisOrbObject = Me
End Function

'Helper
Private Function cOrbObject_setObjRef(ByVal ObjRef As cOrbObjRef, _
    ByVal Check As Boolean) As Boolean
    On Error GoTo ErrHandler
    If ObjRef Is Nothing Then
        cOrbObject_setObjRef = True
    Else
        cOrbObject_setObjRef = False
        Call ObjRef.narrow(sTypeId, Check, False)
    End If
    Set oObjRef = ObjRef
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "setObjRef")
End Function

'Helper
Private Function cOrbObject_getObjRef() As cOrbObjRef
    Set cOrbObject_getObjRef = oObjRef
End Function

'Helper
Private Function cOrbObject_getId() As String
    cOrbObject_getId = sTypeId
End Function

'setId()
Public Sub setId(ByVal id As Long)
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("setId", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call oOut.writeLong(id)
    Call oRequest.invokeReqst(False)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "setId")
End Sub

'getId()
Public Function getId() As Long
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("getId", False)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    getId = oIn.readLong()
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "getId")
End Function

'start()
Public Sub start()
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("start", False)
    Call oRequest.invokeReqst(False)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "start")
End Sub

'stop()
Public Function stopFunc() As String
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("stop", False)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    stopFunc = oIn.readString()
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "stopFunc")
End Function

'sendBigArrayToClient()
Public Sub sendBigArrayToClient(ByVal buffer As c_ByteArr4096)
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("sendBigArrayToClient", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call buffer.writeMe(oOut)
    Call oRequest.invokeReqst(False)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "sendBigArrayToClient")
End Sub

'sendWStringToClient()
Public Sub sendWStringToClient(ByVal wstr As String)
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("sendWStringToClient", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call oOut.writeWstring(wstr)
    Call oRequest.invokeReqst(False)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "sendWStringToClient")
End Sub
