BCA_Lib
 All Classes Files Functions Pages
AntCallbackInterface.h
Go to the documentation of this file.
1 #ifndef __BCA_ANTCALLBACKINTERFACE_H__
2 #define __BCA_ANTCALLBACKINTERFACE_H__
3 
4 #include "BCA_Lib.h"
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 //
13 // callback interface
14 //
15 BCA_LIB_API void* BCA_OpenDevice(unsigned char device_no = 0);
16 // init ant device
17 BCA_LIB_API int BCA_Init(void* antDevice);
18 // regist send callback function
19 BCA_LIB_API void BCA_RegisterSendFunc(void* antDevice,
20  void (*func)(void* context, unsigned char channel, void* cookie),
21  void* cookie);
22 // regist receive callback function
23 BCA_LIB_API void BCA_RegisterReceiveFunc(void* antDevice,
24  void (*func)(void* context, unsigned char channel, unsigned char event,
25  void* data, unsigned int length, void* cookie), void* cookie);
26 // regist event callback function
27 BCA_LIB_API void BCA_RegisterEventFunc(void* antDevice,
28  void (*func)(void* context, unsigned char channel, unsigned char event, void* data, void* cookie),
29  void* cookie);
30 
31 // open channel
32 BCA_LIB_API int BCA_OpenChannel(void* antDevice,
33  unsigned char channel_no, // channel number(0-7)
34  unsigned char channel_type, // master/slave
35  unsigned char shared, // shared/noshared
36  unsigned short device_no, // device no 0-65535
37  unsigned char device_type, // device type 0,1-127
38  unsigned char trans_type, // trans type 0,1-255
39  unsigned char freq, // +2400Mhz(0-255)
40  double hz); // channel period(0.5-32768Hz)
41 // close channel
42 BCA_LIB_API int BCA_CloseChannel(void* antDevice,
43  unsigned char channel_no);
44 // send data
45 BCA_LIB_API int BCA_SendData(void* antDevice,
46  unsigned char channel_no,
47  void* data,
48  unsigned int length);
49 // Send Acknowledged Data
50 BCA_LIB_API int BCA_SendAcknowledgedData(void* antDevice,
51  unsigned char channel_no,
52  void* data,
53  unsigned int length);
54 // Send BurstTransfer Data
55 BCA_LIB_API int BCA_SendBurstTransfer(void* antDevice,
56  unsigned char channel_no,
57  void* data,
58  unsigned int length);
59 // reset ANT device
60 BCA_LIB_API int BCA_Reset(void* antDevice);
61 // clsoe ANT device
62 BCA_LIB_API int BCA_CloseDevice(void* antDevice);
63 // set transmit power
64 BCA_LIB_API int BCA_SetTransmitPower(void* antDevice,
65  unsigned char power);
66 // set channel transmit power
67 BCA_LIB_API int BCA_SetChannelTxPower(void* antDevice,
68  unsigned char channel_no,
69  unsigned char power);
71 // pairing function
73 
74 // regist pairing callback function
75 BCA_LIB_API void BCA_RegisterPairingFunc(void* antDevice,
76  void (*func)(void* context, int* devicelist, unsigned char count, void* cookie),
77  void* cookie);
78 // start pairing
79 BCA_LIB_API int BCA_StartPairing( void* antDevice,
80  int freq,
81  double hz, // channel period(0.5-32768Hz)
82  int search_sec);
83 // stop pairing
84 BCA_LIB_API int BCA_StopPairing(void* antDevice);
85 // get pairing serach device info
86 BCA_LIB_API int BCA_GetPairingDeviceInfo(void* antDevice,
87  unsigned char index,
88  int *device_no,
89  int *device_type,
90  int *trans_type);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif // __BCA_ANTCALLBACKINTERFACE_H__