LoRa Access Point 1.5.2018
Dependencies: mbed ds3231 SX1276Lib_LoRa_Access_Point
Diff: HC05.cpp
- Revision:
- 5:19b34c4d27a1
- Parent:
- 2:0499e1d037a5
- Child:
- 6:1ee035ae2a2c
--- a/HC05.cpp Mon Apr 30 17:09:34 2018 +0000 +++ b/HC05.cpp Mon Apr 30 22:41:48 2018 +0000 @@ -2,9 +2,9 @@ const char* BT_ALIVE_RESPONSE = "~~LoRa Gateway~~"; -HC05 bt(BT_TX,BT_RX); // Globalna instancia +HC05 bt(BT_TX,BT_RX); -HC05::HC05(PinName tx, PinName rx) +HC05::HC05(PinName tx, PinName rx) : btUart(tx,rx,BAUDRATE) { ClearBuffer(); @@ -29,47 +29,22 @@ buffer[pt++] = c; if(pt >= BUFFERSIZE - 1) ClearBuffer(); - - if(c =='\n') - { + + if(c =='\n') { if( strncmp( ( const char* )buffer, "~~~", 3 ) == 0 ) - { btUart.printf("%s\r\n", BT_ALIVE_RESPONSE); -// pc.printf("%s", buffer); - } - + if( strncmp( ( const char* )buffer, "AT+SAVETRANSLINK=", 17 ) == 0 ) - { -// memcpy(server_ip_address, bt_Buffer, sizeof(server_ip_address)); - wifi.SetIpOfServer(buffer); -// set_server_ip_address = true; -// esp.printf("%s",server_ip_address); -// pc.printf("%s", buffer); -// btUart.printf("OK\r\n"); - } - + wifi.SetIpOfServer(buffer); + if( strncmp( ( const char* )buffer, "AT+CWJAP=", 9 ) == 0 ) - { wifi.SetWiFiConnection(buffer); -// memcpy(wifi_connection, bt_Buffer, sizeof(wifi_connection)); -// set_wifi_connection = true; -// esp.printf("%s",server_ip_address); -// pc.printf("%s", buffer); -// btUart.printf("OK\r\n"); - } + ClearBuffer(); } - }; void HC05::Send(char* message) { btUart.printf("%s\r\n",message); -}; - -/* -Serial HC05::GetSerial() -{ - return btUart; -} -*/ \ No newline at end of file +}; \ No newline at end of file