4 * Created on: 2014. 11. 5.
13 #define BLE_NOCHANGE -1
17 #define BLE_DISCON 200
18 #define BLE_NODATA 100
21 /***************************************
23 * HM-10 BLE Module Control Class.
24 * Target Board : Arduino-Mega.
26 **************************************/
31 * BLE Control Function.
33 // BLE initialization ( COM baud rate , BLE Master , Slave setting. )
34 void init(long baudRate, int ble_mode, char* SelfMaxAddr);
36 void StatusRead( void );
38 bool IsSelfArduino( void );
40 bool IsConnected( void );
42 bool pollingConnect( const char* maxAddr );
44 void pollingDisconnect( void );
45 // Get RSSI by BLE communication. (polling method.)
46 int pollingGetRSSI( void );
47 // Send Request to BLE Module. And, Get the response. (polling method.)
48 bool pollingRequest(const char* request, char* data, int dataLen);
50 int mustHaveRequest(const char* request, char* data, int dataLen);
52 void streamDummy( char* data, int dataLen);
55 * Debug COM port to BLE COM port.
56 * BLE COM port to Debug COM port.
58 // BLE Module to Debug Serial port.
59 void BLE2Debug( int autoDiscon );
60 // Debug Serial port to BLE Module.
61 char* Debug2BLE( int BLEwrite );
64 * If you first setting, you need next-function.
66 // Restore to factory setting data.
67 void FactoryReset( void );
68 // First setting of COM port.
69 void firstUartSetting( void );
75 #define debug_printf(...) { \
76 char* __temp__ = (char*)malloc(sizeof(char)*2048); \
77 sprintf(__temp__, __VA_ARGS__ ); \
78 Serial.print(__temp__); \
82 #define debug_printf(...)
87 #endif /* BLELIB_H_ */