LinuxSDK  V1.4.0.5
Functions | Variables
SwiApiDemux.c File Reference

Contains source code for Basic Demux API functions for the the SDK. More...

#include "apdxidefs.h"

Functions

package struct apdxcb * SwiApDxGetCbp (void)
 
package struct apdxipccb * SwiApDxGetIPCCbp (swi_uint16 deviceservice)
 
package swi_bool SwiApDxRunning (void)
 
package swi_bool SwiApDxAirServerPresent (void)
 
package swi_uint32 SwiApDxDevToChan (swi_uint16 deviceservice)
 
package swi_uint8SwiApDxDevToName (swi_uint16 deviceservice)
 
SWI_API SWI_RCODE SwiApiDxStartup (swi_uint16 numchannels, struct SWI_STRUCT_ApiStartup *pOpenParams)
 
SWI_API SWI_RCODE SwiApiDxRegister (swi_uint16 deviceservice, void(*datacbfp)(swi_uint16 deviceservice, swi_uint8 *datap, swi_uint32 datalen, void *userp), void *datauserp, void(*ctlcbfp)(swi_uint16 deviceservice, swi_uint8 *ctldatap, void *userp), void *ctluserp)
 
SWI_API SWI_RCODE SwiApiDxBegin (swi_uint16 deviceservice)
 
SWI_API SWI_RCODE SwiApiDxEnd (swi_uint16 deviceservice)
 
SWI_API SWI_RCODE SwiApiDxSend (swi_uint16 deviceservice, swi_uint8 *datap, swi_uint32 datalen)
 
SWI_API SWI_RCODE SwiWaitDxIndication (swi_uint16 deviceservice)
 
SWI_API SWI_RCODE SwiGetDataPldOffset (swi_uint8 *bufferp, swi_uint32 datalen, swi_uint8 **payloadpp, swi_uint32 *bytesbuildp)
 

Variables

struct apdxcb apdxcbk
 
swi_uint8 apdxmsgarray [APDXBUFSIZE]
 
swi_uint8 inbuf [APDXBUFSIZE]
 

Detailed Description

Contains source code for Basic Demux API functions for the the SDK.

Copyright: © 2011 Sierra Wireless, Inc. all rights reserved

Function Documentation

package swi_bool SwiApDxAirServerPresent ( void  )

Determine whether the device is present

Returns
TRUE - air server present
FALSE - air server is not loaded onto the system
package swi_uint32 SwiApDxDevToChan ( swi_uint16  deviceservice)

Maps a deviceservice to a predefined channel id

Parameters
deviceservice,:[IN] device service - diagnostics, NMEA, etc...
Returns
the channel id if successful mapping
CIMAXIPCCHAN if the device service is not supported
package swi_uint8* SwiApDxDevToName ( swi_uint16  deviceservice)

Return a pointer to identification string for a device service

Parameters
deviceservice,:[IN] device service - diagnostics, NMEA, etc..
Returns
pointer to string structure
package struct apdxcb* SwiApDxGetCbp ( void  )
read

Return a pointer to the APDX package's control block

Returns
pointer to apdxcb structure
package struct apdxipccb* SwiApDxGetIPCCbp ( swi_uint16  deviceservice)
read

Return a pointer to the APDX package's IPC control block for a particular device service

Parameters
deviceservice,:[IN] device service - diagnostic or NMEA
Returns
pointer to apdxipccb structure
package swi_bool SwiApDxRunning ( void  )

Determine whether the API has been previously started

Returns
TRUE - API is initialized and running
FALSE - API was not properly started. Go back and start it up
SWI_API SWI_RCODE SwiApiDxBegin ( swi_uint16  deviceservice)

This function is used to format and send a Demux Request to Start a specific device service. After this command SDK starts to send data for that particular device service

If an error is returned or to re-initialize the API, SwiApiDxShutdown must be called before calling this function again.

Looking in the system log after a failure may provide more details about the cause

Parameters
deviceservice: device service requested - diagnostic or NMEA
Returns
SWI_RCODE_OK - API control indication send successfully
See SWI_RCODE for other error return codes
SWI_API SWI_RCODE SwiApiDxEnd ( swi_uint16  deviceservice)

This function is used to format and send a Demux Request to Stop a specific device service. After this command SDK stops to send data for that particular device service

If an error is returned or to re-initialize the API, SwiApiDxShutdown must be called before calling this function again.

Looking in the system log after a failure may provide more details about the cause

Parameters
deviceservice: device service requested
Returns
SWI_RCODE_OK - API control indication send successfully
See SWI_RCODE for other error return codes
SWI_API SWI_RCODE SwiApiDxRegister ( swi_uint16  deviceservice,
void(*)(swi_uint16 deviceservice, swi_uint8 *datap, swi_uint32 datalen, void *userp)  datacbfp,
void *  datauserp,
void(*)(swi_uint16 deviceservice, swi_uint8 *ctldatap, void *userp)  ctlcbfp,
void *  ctluserp 
)

This function is used to register for device service with the API Demux sub-system.

If an error is returned or to re-initialize the API, SwiApiDxShutdown must be called before calling this function again.

Looking in the system log after a failure may provide more details about the cause

Parameters
deviceservice: device service requested - diagnostic or NMEA
datacbfp: pointer to user callback function for Demux Data
datauserp: user parameter for data callback
ctlcbfp: pointer to user callback for control indication
ctluserp: User parameter for control indication callback
Returns
SWI_RCODE_OK - API registered successfully
SWI_RCODE_FAILED - The API sub-system was not registered successfully.
SWI_RCODE_SYSTEM_ERROR - This may be due to limited system resources when the API requested memory from the OS.
See SWI_RCODE for other error return codes
SWI_API SWI_RCODE SwiApiDxSend ( swi_uint16  deviceservice,
swi_uint8 datap,
swi_uint32  datalen 
)

This function is used to send a Demux Data Indication to a specific device service.

If an error is returned or to re-initialize the API, SwiApiDxShutdown must be called before calling this function again.

Looking in the system log after a failure may provide more details about the cause

Parameters
deviceservice,:[IN] device service requested
datap,:[IN] pointer to the beginning of the buffer to be send
datalen,:[IN] length of total data to be send
Returns
SWI_RCODE_OK - API data indication send successfully
SWI_RCODE_INVALID_PAR - device service does not have open channel
SWI_RCODE_DEVICE_UNAVAIL - air server is not loaded onto the system
SWI_RCODE_NOT_INIT - this is not initialized data packet
See Also
Returns
See SWI_RCODE for other error return codes
SWI_API SWI_RCODE SwiApiDxStartup ( swi_uint16  numchannels,
struct SWI_STRUCT_ApiStartup pOpenParams 
)

This function is used to start the API Demux sub-system.

If an error is returned or to re-initialize the API, SwiApiDxShutdown must be called before calling this function again.

Looking in the system log after a failure may provide more details about the cause

Parameters
numchannels,:[IN] the number of channels the Application intends to use (for verification purposes)
pOpenParams,:[IN] parameters to initialize the API in different modes
Returns
SWI_RCODE_OK - API initialized successfully
SWI_RCODE_FAILED - The API sub-system was not initialized successfully.
SWI_RCODE_SYSTEM_ERROR - This may be due to limited system resources when the API requested memory from the OS.
SWI_RCODE_BUSY - If another application has the SDK open. Only 1 application at a time is allowed
SWI_RCODE_NOT_COMPATIBLE - the SDK and the Application cannot work together
See SWI_RCODE for other error return codes
SWI_API SWI_RCODE SwiGetDataPldOffset ( swi_uint8 bufferp,
swi_uint32  datalen,
swi_uint8 **  payloadpp,
swi_uint32 bytesbuildp 
)

This function is used to obtain the payload pointer within Demux Data Indication packet.

If an error is returned or to re-initialize the API, SwiApiDxShutdown must be called before calling this function again.

Looking in the system log after a failure may provide more details about the cause

Parameters
bufferp,:[IN] pointer to the beginning of caller-allocated buffer which will contain data to send
datalen,:[IN] length of data to be send
payloadpp,:[OUT] pointer to pointer to beginning of payload
bytesbuildp,:[OUT] number of bytes added at the beginning of the buffer (i.e. the number of bytes in the header)
Returns
SWI_RCODE_OK - API data indication send successfully
SWI_RCODE_INVALID_PAR - data length requested is too long
See SWI_RCODE for other error return codes
SWI_API SWI_RCODE SwiWaitDxIndication ( swi_uint16  deviceservice)

The Demux receive API main entry point

When the received packet is wrong type the message "Wrong packet type" is logged and program terminates.

This function waits to receive demux indications and invokes the user callback function if registered. This function does not return unless there is an error.

Returns
SWI_RCODE_OK - The function executed properly.
SWI_RCODE_FAILED - The function failed to execute correctly.
SWI_RCODE_API_NOT_OPEN - SDK is not running.
See Also
See SWI_RCODE for additional information.

Variable Documentation

struct apdxcb apdxcbk
swi_uint8 apdxmsgarray[APDXBUFSIZE]
swi_uint8 inbuf[APDXBUFSIZE]

Linux SDK V1.4.0.5
Copyright (c) 2011 Sierra Wireless, Inc. All rights reserved