Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

exgtransport.h

Go to the documentation of this file.
00001 
00006 #ifndef EXGTRANSPORT_H_
00007 #define EXGTRANSPORT_H_
00008 
00009 #include <hiker/exgmgr.h>
00010 
00011 #ifdef __cplusplus
00012  extern "C"
00013  {
00014 #endif
00015 
00016 // Prototypes for functions each transport library must implement
00017 
00018 #define ALP_EXG_TRANSPORTS_MAX_COUNT 5
00019 #define ALP_EXG_TRANSPORT_NAME_MAX_LEN 30       // Transport nameId max len
00020 
00023 #define ALP_EXG_TRANSPORT_EVENT_INCOMING_REQUEST 1      
00024 #define ALP_EXG_TRANSPORT_EVENT_FATAL_ERROR 2           
00025 
00026 
00027 typedef alp_status_t (*alp_exg_transport_event_notify_func) (int iTransportId, int iTransportEvent, void *iTransportEventData, size_t iTransportEventDataSize);
00028 typedef alp_status_t (*alp_exg_transport_init_func) (alp_exg_transport_event_notify_func iTransportEventNotifyFunc, int iTransportId);
00029 typedef alp_status_t (*alp_exg_transport_deinit_func) ();
00030 typedef alp_status_t (*alp_exg_transport_dispatch_result_func) (AlpExgRequest iRequest, alp_status_t iHandlerErr);
00031 typedef alp_status_t (*alp_exg_transport_execute_request_func) (AlpExgRequest iRequest, GPollFD *iPollFd, int *iState);
00032 typedef alp_status_t (*alp_exg_transport_ask_params_func) (char **oTransportParams);
00033 typedef alp_status_t (*alp_exg_transport_cancel_func) (int iGuid);
00034 
00035 // Each asynchronous execute request maintains this:
00036 typedef struct _AlpExgClientExecuteData
00037 {
00038         int isUsed;
00039         alp_exg_execute_complete_func itsExecuteCompleteFunc;
00040         AlpExgRequest itsRequestP;
00041         alp_exg_transport_execute_request_func itsTransportExecuteRequestFunc;
00042         int itsState;
00043         GPollFD itsPollFd;
00044 } AlpExgClientExecuteData;
00045 
00046 // This is the global GSource used to manage callbacks when executing asynchronous request.
00047 // The EXG_MAX_ASYNC_EXEC_COUNT limit is a per process limit. 
00048 #define EXG_MAX_ASYNC_EXEC_COUNT 3
00049 typedef struct _AlpExgClientExecGSource
00050 {
00051         GSource itsGSource;
00052         AlpExgClientExecuteData itsExecuteData[EXG_MAX_ASYNC_EXEC_COUNT];       // table
00053 } AlpExgClientExecGSource;
00054 
00055 // state returned in AlpExgClientExecuteData.itsState when execution is complete
00056 #define ALP_EXG_TRANSPORT_EXECUTE_INIT_STATE 0
00057 #define ALP_EXG_TRANSPORT_EXECUTE_COMPLETE_STATE 0xffff
00058 
00059 // Common structure that can be used by transports to send result or progress info while waiting for request execution
00060 #define ALP_EXG_MSG_RESULT 1
00061 #define ALP_EXG_MSG_PROGRESS_PREPARING 2
00062 #define ALP_EXG_MSG_PROGRESS_CONNECTING 3
00063 #define ALP_EXG_MSG_PROGRESS_SENDING 4
00064 #define ALP_EXG_MSG_PROGRESS_DISCONNECTING 5
00065 #define ALP_EXG_MSG_PROGRESS_ABORTING 6
00066 
00067 #define ALP_EXG_MSG_RX_BT_CONNECTING 10         // bdaddr
00068 #define ALP_EXG_MSG_RX_IR_CONNECTING 11
00069 #define ALP_EXG_MSG_RX_BT_INIT_OBJECT 12        // bdaddr, null
00070 #define ALP_EXG_MSG_RX_IR_INIT_OBJECT 13
00071 #define ALP_EXG_MSG_RX_BT_FILENAME 14                   // bdaddr, filename
00072 #define ALP_EXG_MSG_RX_IR_FILENAME 15           // filename
00073 #define ALP_EXG_MSG_RX_BT_RECEIVING_INFO 16     // bdaddr, description
00074 #define ALP_EXG_MSG_RX_IR_RECEIVING_INFO 17     // description
00075 #define ALP_EXG_MSG_RX_BT_RECEIVING_INFO_NODESC 18      // bdaddr, null
00076 #define ALP_EXG_MSG_RX_IR_RECEIVING_INFO_NODESC 19
00077 
00078 #define ALP_EXG_RCV_PROGRESS_NOTIF_TYPE "exg_obex_rcv_progress"
00079 
00080 #define ALP_EXG_MSG_PROGRESS_INFO_MAX_LEN 50
00081 
00082 typedef struct _AlpExgWaitExecuteResultMsg
00083 {
00084         int itsMsgType;
00085         union
00086         {
00087                 struct _result
00088                 {
00089                         alp_status_t itsReplyStatus;
00090                 } result;
00091                 
00092                 struct _progress
00093                 {
00094                         char itsString1[ALP_EXG_MSG_PROGRESS_INFO_MAX_LEN+1];
00095                         char itsString2[ALP_EXG_MSG_PROGRESS_INFO_MAX_LEN+1];
00096                 } progress;
00097         } params;
00098 } AlpExgWaitExecuteResultMsg;
00099 
00110 alp_status_t alp_exg_transport_event_notify (int iTransportId, int iTransportEvent, void *iTransportEventData, size_t iTransportEventDataSize);
00111 
00126 alp_status_t alp_exg_transport_init (alp_exg_transport_event_notify_func iTransportEventNotifyFunc, int iTransportId);
00127 
00136 alp_status_t alp_exg_transport_deinit ();
00137 
00138 // function called when a request has been dispatched and result is available
00151 alp_status_t alp_exg_transport_dispatch_result (AlpExgRequest iRequest, alp_status_t iHandlerErr);
00152 
00162 alp_status_t alp_exg_transport_execute_request (AlpExgRequest iRequest, GPollFD *iPollFd, int *iState);
00163 
00173 alp_status_t alp_exg_transport_ask_params (char **oTransportParams);
00174 
00186 alp_status_t alp_exg_transport_cancel (int iGuid);
00187 
00188 #ifdef __cplusplus
00189  }
00190 #endif
00191 
00192 #endif /*EXGTRANSPORT_H_*/

Generated on Sat Dec 16 20:29:47 2006 for hiker-0.9 by  doxygen 1.4.4