BCA_Lib

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Files Functions Pages
AntDevice.h
Go to the documentation of this file.
1 ﻿#ifndef __BCA_ANTDEVICE_H__
2 #define __BCA_ANTDEVICE_H__
3
4 #include "BCA_Lib.h"
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12
13 class AntInterface;
14 class impl_antdevice;
15
16 class BCA_LIB_API AntDevice
17 {
18 public:
19 AntDevice();
20 virtual ~AntDevice(void);
22 // device
24 int openDevice(unsigned char number = 0);
25 int closeDevice();
27 // channel
29 // open channel
30 // open channel
31 int openChannel(unsigned char channel_no, // channel number(0-7)
32 unsigned char channel_type, // master/slave
33 unsigned char shared, // shared/noshared
34 unsigned short device_no, // device no 0-65535
35 unsigned char device_type, // device type 0, 1-127
36 unsigned char trans_type, // trans type 0-255
37 unsigned char freq, // +2400Mhz(0-255)
38 double hz); // channel period(0.5-32768Hz)
39 // close channel
40 int closeChannel(unsigned char channel_no);
41
42 // send data
43 int sendData(unsigned char channel_no,
44 void* data,
45 unsigned int length);
46
47 // Send Acknowledged Data
48 int sendAcknowledgedData(unsigned char channel_no,
49 void* data,
50 unsigned int length);
51
52 // Send BurstTransfer Data
53 int sendBurstTransfer(unsigned char channel_no,
54 void* data,
55 unsigned int length);
56 // reset
57 int Reset();
59 // pairing
61 // pairing(RX ONLY)
62 int startPairing(unsigned char freq,
63 double hz,
64 unsigned char search_sec);
65
66 // stop pairing
67 int stopPairing();
68
69 // get pairing serach device info
70 int getPairingDeviceInfo(unsigned char index,
71 int *device_no,
72 int *device_type,
73 int *trans_type);
74
76 // user impl(receive data)
78 virtual int receiveData(unsigned char channel,
79 unsigned char event,
80 void* data,
81 unsigned int length);
82
84 // user impl(send data)
86 virtual int sendData(unsigned char channel);
87
89 // user impl(receive event)
91 virtual int receiveEvent(unsigned char channel,
92 unsigned char event,
93 void* data,
94 unsigned int length);
95
97 // impl (pairing)
99 virtual void searchResult(int* devicelist,
100 unsigned char count);
101
103 // (etc)
105 // set transmit power
106 int setTransmitPower(unsigned char power);
107
108 // set channel transmit power
109 int setChannelTxPower(unsigned char channel_no, unsigned char power);
110
111 private:
112 // event
113 bool event(unsigned char channel, unsigned char evnt);
114 // response
115 bool response(unsigned char channel, unsigned char message);
116 // data
117 bool data(unsigned char channel, unsigned char message);
118
119 //
120 static long startThread(void* data);
121 int recvThread();
122 int stopThread();
123 void addDeviceNumber(int deviceNumber, int device_type, int trans_type);
124
125 //
126 int startCollectionDevice();
127 void stopCollectionDevice();
128 static long collectionThread(void* data);
129 void collectionLoop();
130 int pairingDevice();
131
132
133 impl_antdevice* _impl;
134
135 };
136
137 #ifdef __cplusplus
138 }
139 #endif
140
141 #endif // __BCA_ANTDEVICE_H__
142