CHAI SDK  Version 1.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Request notification

A Request is a special notification called when the CHAI needs some information from the application side (e.g. in case of remote editing). Request calls notification handler methods are identified by the ***_Request*** substring inside their name and a RequestID argument.

The application returns FALSE if it does not support a request. Otherwise, it returns TRUE and must call (asynchronously if needed) one of the reply methods of the related object. A reply method is identified by its Reply_*** prefix and a RequestID argument. It can be called asynchronously from outside the notification handler. A notification handler can flag the application, return TRUE and then let another thread calling the Reply_*** method later on.

Note
Each Request is internally handled by a Task. If the application does not call a Reply_*** method for a RequestID, the task goes in time-out after 2 seconds and then automatically notifies a failure to the requester. It is possible to disable this timeout using CPNS::ICHAI::SetAsyncTimeouts. In that case, if a task remains alive for more than 1 minute, the CHAI broadcasts a Warning message over the network to tell the anomaly to the programmer.

Example of request:

//From interface IBaseLocalDevice_SetupNotificationHandler:
CPNS::boolean OnBaseLocalDevice_RequestCollectSetupData(
IN CPNS::IBaseLocalDevice * const pNotifiedObject,
IN CPNS::uint16 const wRequestID,
IN CPNS::Enums::SetupTypes const type,
IN CPNS::uint32 const dwOffset,
IN CPNS::uint32 const dwContextData,
IN CPNS::uint16 const wMaxBlockSize
);

Example of reply:

// From interface IBaseLocalDevice:
CPNS::Enums::Errors Reply_RequestCollectSetupData(
IN CPNS::uint16 const wRequestID,
IN CPNS::Enums::SetupBlockPriorities const priority,
IN CPNS::uint32 const dwContextData,
IN CPNS::uint16 const wBlockSize,
IN CPNS::boolean const fLastBlock,
IN CPNS::byte const * const pBlockData
);