00001
00002
00003
00004
00005
00006
00007 #ifndef BLUETOOTH_H_
00008 #define BLUETOOTH_H_
00009
00010
00011 extern "C"
00012 {
00013 #include "ecrobot_interface.h"
00014 #include "rtoscalls.h"
00015 };
00016
00017 namespace ecrobot
00018 {
00026 class Bluetooth
00027 {
00028 public:
00032 static const U32 MAX_BT_DATA_LENGTH = 254;
00033
00043 Bluetooth(void);
00044
00051 ~Bluetooth(void);
00052
00059 bool waitForConnection(const CHAR* passkey, U32 duration);
00060
00068 bool waitForConnection(const CHAR* passkey, const U8 address[7], U32 duration);
00069
00077 void cancelWaitForConnection(void);
00078
00084 bool getDeviceAddress(U8 address[7]) const;
00085
00091 bool getFriendlyName(CHAR* name) const;
00092
00099 bool setFriendlyName(const CHAR* name);
00100
00106 bool isConnected(void) const;
00107
00114 U32 send(U8* data, U32 length);
00115
00122 U32 receive(U8* data, U32 length) const;
00123
00132 void setFactorySettings(void);
00133
00134 private:
00135 bool mIsConnected;
00136 bool mCancelConnection;
00137 void close(void);
00138 };
00139 }
00140
00141 #endif