iscEngineListenerPF defines the prototype that the user-defined listener function registered in iscEngineSetListener() should comply with.
Syntax
typedef isy_INT32 (*iscEngineListenerPF)( isy_UINT32 listenerData, ISCEVT* event, isy_VOID* pExtraInfo);
Function arguments
ǥ 139 lists the valid arguments used
with the iscEngineSetListenerPF function type.
ǥ 139. iscEngineListenerPF arguments
Data type | Argument | Use | Description |
---|---|---|---|
isy_UINT32 | listenerData | input | Data set in the syncListenerData argument by iscEngineSetListener() is forwarded back to the listener function |
ISCEVT* | event | input | Event object |
isy_VOID* | pExtraInfo | input | Reserved |
Usage
To use a user-define listener function for monitoring the progress of synchronization you must first make the function comply with the iscEngineSetListenerPF function type. Next, register the listener function using the iscEngineSetListener() function. Then, the user-defined listener function will be notified when synchronization events occur. The event argument is a structure, which contains various information about that event.
ǥ 140 lists all the fields in the
event structure and the purpose of each field.
ǥ 140. iscEngineListenerPF event fields
Field | Description | |
---|---|---|
type | The event type
can be one of the following values (actual values in the parentheses):
| |
state | The event state, which contains the following
sub-fields:
| |
retry | The number of retries on the same event, if not 0. | |
info | Optional event-specific information (if not NULL), which is an array of string arguments for non-conflict events. For conflict events, the data type is ISCLISTENCONFLICT. |
The event.info field contains some optional event-specific information. The event code is used to identify and interpret this information.
ǥ 141 lists all the event codes
by category of event type.
ǥ 141. iscEngineListenerPF event codes
Event type: ISCEVTTYPE_Info | |||
Event code | Event info (argc) | Description | |
---|---|---|---|
ISCEVT_InfGeneral (1000) | NULL | General information (for debugging). | |
ISCEVT_InfSyncStarted (1001) | NULL | Synchronization started. | |
ISCEVT_InfPrepMsg (1002) | NULL | Preparing message. | |
ISCEVT_InfSendMsg (1003) | NULL | Sending message. | |
ISCEVT_InfWaitMsg (1004) | NULL | Awaiting server reply. | |
ISCEVT_InfApplyMsg (1005) | NULL | Applying server message. | |
ISCEVT_InfCancelingSync (1006) | NULL | Canceling synchronization. | |
ISCEVT_InfSubsSetStarted (1007) | NULL | Synchronization of a subscription set started. | |
ISCEVT_InfSyncingSubs (1008) | NULL | Synchronization of a subscription has started. | |
ISCEVT_InfSubsSetFailed (1009) | NULL | Synchronization of a subscription set failed. | |
ISCEVT_InfSubsSetCanceled (1010) | NULL | Synchronization of a subscription set has been canceled. | |
ISCEVT_InfSubsSetSucceeded (1011) | NULL | Synchronization of a subscription set completed successfully. | |
ISCEVT_InfSyncSucceeded (1012) | NULL | Synchronization succeeded. | |
SCEVT_InfSyncFailed (1013) | NULL | Synchronization (on some subscription sets) failed. | |
ISCEVT_InfSyncCanceled (1014) | NULL | Synchronization canceled (by the user). | |
ISCEVT_InfSyncProg (1015) | NULL | Synchronization progress expressed as a percentage. | |
ISCEVT_InfNoNewChange (1016) | NULL | No new server change; skip pull and confirm phases. | |
ISCEVT_InfLoginFailed (1017) | NULL | Specified login information does pass the authentication process. |
ǥ 142. iscEngineListenerPF event codes
Event type: ISCEVTTYPE_Conflict | |||
Event code | Event info (argc) | Description | |
---|---|---|---|
ISCEVT_CftReject (2000) | ISCLISTENCONFLICT | Data conflicts found in the synchronization.The actual conflicting data is represented as a ISCLISTENCONFLICT structure, and its reference pointer is given back to the application through event.info. |
ǥ 143. iscEngineListenerPF event codes
Event type: ISCEVTTYPE_Retry | |||
Event code | Event info (argc) | Description | |
---|---|---|---|
ISCEVT_TryNetConn (4601) | NULL | Try again to connect to the server. | |
ISCEVT_TrySendRequest (4602) | NULL | Try again to send the request. | |
ISCEVT_TryRecvReply (4603) | NULL | Try again to receive the reply. | |
ISCEVT_TryRecvTimeout (4604) | NULL | Wait longer for the receiving reply. | |
SCEVT_TryRecvAck (4605) | NULL | Try again to receive an acknowledgement. |
ǥ 144. iscEngineListenerPF event codes
Event type: ISCEVTTYPE_Query | ||
Event code | Event info (argc) | Description |
---|---|---|
ISCEVT_QueCancel (5000) | NULL | Inquiry if the user cancels and returns (actual values
in the parentheses):
|
ISCEVT_QueCancelUponError (5001) | NULL | Inquiry if the user cancels and returns (actual values
in the parentheses):
|
ISCEVT_QueLogin (5002) | ISCLISTENARG(3)
info->argv[0] info->argv[1] info->argv[2] | Login information requested by an adapter. The listener
must provide the requested information in the event info and should return ISCRTNCB_Done with the actual value (1).
Target name of data source Blank buffer for holding the user name Blank buffer for holding the password |
ISCEVT_QueSubsTarget (5003) |
ISCLISTENARG(1) info->argv[0]
|
Database information requested by an adapter. The listener may provide the requested information in the event info and return ISCRTNCB_Done or return ISCRTNCB_Default to use the default target directory. Directory for subscription.
|
ǥ 145. iscEngineListenerPF event codes
Event type: ISCEVTTYPE_Error | |||
Event code | Event info (argc) | Description | |
---|---|---|---|
ISCEVT_ErrOpenAdapter (300) | NULL | Failed to open adapter <adapter name>. | |
ISCEVT_ErrLoadAdapter (301) | NULL | Failed to load adapter <adapter name>. | |
ISCEVT_ErrCloseAdapter (302) | NULL | Failed to close adapter <adapter name>. | |
ISCEVT_ErrAuthenticateKey (306) | NULL | Authentication failed (invalid encryption key); synchronization aborted. | |
ISYNCEVT_ErrClientCryptoFailed (307) | NULL | Client encryption or decryption failed; synchronization aborted. | |
ISCEVT_ErrEncryptNotAvail (308) | NULL | Encryption not available. | |
ISCEVT_ErrEncryptLibOpen (309) | NULL | Failed to open encryption library. | |
ISCEVT_ErrSubsNotFound (311) | NULL | Subscription not found by the server. | |
ISCRTN_ErrSubsNotAvail (312) | NULL | Subscription blocked by the server. | |
ISCRTN_ErrSubsDefAltered (316) | NULL | Subscription definition altered since the last time the sync engine synchronizes the configuration. | |
ISCEVT_ErrAllocResource (400) | NULL | Failed to allocate adapter resources. | |
ISCEVT_ErrConnectData (401) | NULL | Failed to connect to the target data. | |
ISCEVT_ErrDisconnectData (402) | NULL | Failed to disconnect from the target data. | |
ISCEVT_ErrNoData (403) | NULL | No data found. | |
ISCEVT_ErrMessageFormat (412) | NULL | Unexpected message format. | |
ISCEVT_ErrNotFound (413) | ISCLISTENARG(2)
info->argv[0] info->argv[1] | Requested data not found.
Target name of data source Data name | |
ISCEVT_ErrEndOfData (414) | NULL | Unexpected end-of-data. | |
ISCEVT_ErrDataTooLong (415) | ISCLISTENARG(3)
info->argv[0] info->argv[1] info->argv[2] | Data is too long and is truncated.
Target name of data source Data name Data element name (if not empty) | |
ISCEVT_ErrSyncDisabled (417) | NULL | Server reported that the user is not enabled. | |
ISCEVT_ErrServerException (418) | NULL | Server reported unknown exceptions. | |
ISCEVT_ErrReadOnly (420) | ISCLISTENARG(2)
info->argv[0] info->argv[1] | Attempted to update read-only data.
Target name of data source Data name | |
ISCEVT_ErrOperation (421) | NULL | Illegal operation on the data. | |
ISCEVT_ErrUnauthorized (423) | NULL | Not authorized to access the target data. | |
ISCEVT_ErrNotAvailable (424) | ISCLISTENARG(2)
info->argv[0] info->argv[1] | Requested data not available.
Target name of data source Data name | |
ISCEVT_ErrNotSupported (425) | ISCLISTENARG(3)
info->argv[0] info->argv[1] info->argv[2] | Requested data is not supported.
Target name of data source Data name Data element name (if not empty) | |
ISCEVT_ErrNetConn (601) | NULL | Failed to connect to the server. | |
ISCEVT_ErrSendRequest (602) | NULL | Failed to send request. | |
ISCEVT_ErrRecvReply (603) | NULL | Failed to receive reply. | |
ISCEVT_ErrRecvTimeout (604) | NULL | Timeout occurred while receiving the reply. | |
ISCEVT_ErrRecvAck (605) | NULL | Failed to receive an acknowledgement. | |
ISCRTN_ErrCloseNetLib (608) | NULL | Failed to close the network library | |
ISCEVT_ErrOutOfMemory (610) | NULL | Out of memory. | |
ISCEVT_ErrInternal (698) | ISCLISTENARG(1)
info->argv[0] | Other internal errors occurred.
Error state (as a string). |
ǥ 146. iscEngineListenerPF event codes
Event type: ISCEVTTYPE_Fatal | ||
Event code | Event info (argc) | Description |
---|---|---|
ISCEVT_FatSyncCfgAbort (303) | NULL | Config sync failed; synchronization aborted. |
ISCEVT_FatAuthenticateFailed (304) | NULL | Authentication failed; synchronization aborted. |
ISCEVT_FatIncompVersion (310) | NULL | Incompatible sync client version. |
ISCEVT_FatInvalidSession (313) | NULL | Invalid session ID. |
ISCEVT_FatSyncGroup (314) | NULL | User does not belong to any sync group. |
ISCEVT_FatRegisterDevice (315) | NULL | Failed to register the device for the user. |
ISCEVT_FatNetOpenConn (600) | NULL | Failed to open a connection to the server. |
ISCEVT_FatOpenNetLib (606) | NULL | Failed to load the Network library. |
ISCEVT_FatResolveHost (609) | NULL | Failed to resolve the host name. |
ISCEVT_FatServerForbidden (611) | NULL | Forbidden to sync to the server. |
ISCEVT_FatServerNotFound (612) | NULL | Server not found |
ISCEVT_FatServer (613) | NULL | Server error. |
ISCEVT_FatServerNotAvail (614) | NULL | Server not responding. |
ISCEVT_FatNetUnknown (699) | NULL | Unknown network error. |
Example:
isy_INT32 mySyncListener( isy_UINT32 listenerData, ISCEVT* event, isy_VOID* pExtraInfo) { char *statusMsg = appEventCodeToMessage(event); int timesRetried; switch (event->type) { case ISCEVTTYPE_Info: appStatusBar(statusMsg); // appStatusBar can be any routine which shows the statusMsg (e.g., in a // status bar) return ISCRTNCB_Done; case ISCEVTTYPE_Retry: timesRetried = event->retry; if (timesRetried >= 3) // Try no more than 3 times return ISCRTNCB_ReplyNo; else return appRetryCancelBox(statusMsg, 10); // 10 sec timeout // appRetryCancelBox can be any routine which shows a window with two // buttons: Cancel and Retry. It returns // ISCRTNCB_ReplyYes, if user clicks Retry // ISCRTNCB_ReplyNo, if user clicks Cancel // If the user doesn't make choice, it returns ISCRTNCB_Default. break; // all other event types, don't care default: return ISCRTNCB_Default; } // switch (event->type) } // mySyncListener
Return codes
If the event type is ISCEVTTYPE_Retry, the listener function returns one of the following codes:
If the event type is ISCEVTTYPE_Query, the meaning of the return code depends on the value of event code. In other words, the listener checks the event code and returns the appropriate value. But if the user does not reply to the query, the application returns the following code:
For event types other than ISCEVTTYPE_Retry and ISCEVTTYPE_Query, the sync engine ignores the return code. The listener simply returns ISCRTNCB_Done.
Note: For those events not of interest, the listener function simply returns ISCRTNCB_Default and allows the sync engine to take the default action.
Note: An asterisk (*) above indicates the default action for various event types.
Restrictions
The user-defined listener function should follow the protocol of the synchronization engine. Otherwise, the synchronization engine might not work correctly.
Related concepts
Related tasks
Related reference