User manual

Table Of Contents
Host Interface
47
The Callback
Object
The callback object code—supplied by the application
code—must completely conform to the cFM2Notify
class definition and must implement the
IFM2DeviceEvents interface. All status change events
and data transmissions are channeled through this object
to the application code. The code within this object will
steer data and events as required by the designer.
The following Visual Basic 6.0 code provides the
minimal framework in the implementation of
cFM2Notify for handling callbacks:
Implements IFM2DeviceEvents
Private m_CallbackEvent As String
Private m_CallbackMessage As String
Private m_DeviceIndex As Integer
Private m_SerialNumber As String
Private m_ZeroDeviceTimeoutCounter As Integer
‘Methods
Private Sub IFM2DeviceEvents_DisplayErrorToClient()
‘Steer the m_CallbackEvent string to the
‘appropriate application code error handler
End Sub
Private Sub IFM2DeviceEvents_NotifyData( _
ByVal CallbackData As IFM2DeviceEvents)
‘Steer the CallbackData object to the appropriate
‘application data event handler
End Sub
Private Sub IFM2DeviceEvents_NotifyDeviceStatus( _
ByVal CallbackData As IFM2DeviceEvents, _
ByVal DevicesList As cFM2Devices)
frmMain.NotifyDeviceStatus CallbackData, DevicesList
‘Steer the CallbackData and DevicesList objects to the
‘appropriate application status event handler
End Sub