Codec decoder functions
If the codec is to provide a decoder, implementations need to be provided for the following functions:
sendTransportEvent
/**
* Called by the event transport to decode an event and send it on to the
* Semantic Mapper. It is assumed that the encoder and transport share
* the same definition of the content of the event, so that the transport
* can effectively interpret the event and free any dynamically-allocated
* memory.
*
* @param decoder The event decoder instance
* @param event The event to be decoded. Ownership is transferred to the
* callee.
* @param timeStamp Timestamps associated with this event. Ownership is
* transferred to the callee.
* @return Event codec error code. If this is not AP_EventCodec_OK, the
* getLastError() function of the decoder should be called to get a more
* detailed description of what went wrong.
*/
AP_EventCodecError (*sendTransportEvent)(struct AP_EventDecoder* decoder,
AP_TransportEvent event, AP_TimestampSet* timeStamp);
setSemanticMapper
/**
* Set the Semantic Mapper object to be used by the decoder. Currently
* only a single Semantic Mapper is supported in each adapter instance.
*
* @param decoder The event decoder instance
* @param mapper The Semantic Mapper to be used
*/
void (*setSemanticMapper)(struct AP_EventDecoder* decoder,
AP_SemanticMapper* mapper);
flushDownstream
/**
* Flush any pending transport events into the attached Semantic Mapper.
* If event processing in the decoder is synchronous (as it usually will
* be) this function need not do anything except return AP_EventCodec_OK.
*
* @param decoder The event decoder instance
* @return Event codec error code. If this is not AP_EventCodec_OK, the
* getLastError() function of the decoder should be called to get a more
* detailed description of what went wrong.
*/
AP_EventCodecError (*flushDownstream)(struct AP_EventDecoder* decoder);
getLastError
/**
* Return the decoder's stored error message, if any. The message string
* is owned by the decoder so should not be modified or freed by the
* caller.
*
* @param decoder The event decoder instance
* @return The last error message generated by the decoder
*/
const AP_char8* (*getLastError)(struct AP_EventDecoder* decoder);