this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Committer:
ocomeni
Date:
Sun Mar 10 09:46:06 2019 +0000
Revision:
74:f26e846adfe9
Child:
75:08eff6258e1b
ATCmdManager now instaltiates ok

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ocomeni 74:f26e846adfe9 1 #include "ATCmdManager.h"
ocomeni 74:f26e846adfe9 2 #include "common_config.h"
ocomeni 74:f26e846adfe9 3
ocomeni 74:f26e846adfe9 4 ATCmdManager::ATCmdManager(PinName tx, PinName rx, bool debug)
ocomeni 74:f26e846adfe9 5 :
ocomeni 74:f26e846adfe9 6 _serial(tx, rx, DEFAULT_BAUD_RATE),
ocomeni 74:f26e846adfe9 7 _parser(&_serial)
ocomeni 74:f26e846adfe9 8
ocomeni 74:f26e846adfe9 9 {
ocomeni 74:f26e846adfe9 10 // constructor
ocomeni 74:f26e846adfe9 11 _serial.set_baud(DEFAULT_BAUD_RATE);
ocomeni 74:f26e846adfe9 12 _parser.debug_on(debug);
ocomeni 74:f26e846adfe9 13 _parser.set_delimiter("\r\n");
ocomeni 74:f26e846adfe9 14 _parser.oob("ATE0", callback(this, &ATCmdManager::_oob_startup_hdlr));
ocomeni 74:f26e846adfe9 15 printf("\n --- ATCmdManager constructor completed ---\n");
ocomeni 74:f26e846adfe9 16 // AT+UBTLE
ocomeni 74:f26e846adfe9 17 }
ocomeni 74:f26e846adfe9 18
ocomeni 74:f26e846adfe9 19
ocomeni 74:f26e846adfe9 20 void ATCmdManager::runMain(){
ocomeni 74:f26e846adfe9 21 while(true){
ocomeni 74:f26e846adfe9 22 _process_oob(UBLOX_ODIN_W2_RECV_TIMEOUT, true);
ocomeni 74:f26e846adfe9 23 wait_ms(MAIN_LOOP_WAIT_TIME_MS); // allow BTLE to be
ocomeni 74:f26e846adfe9 24 }
ocomeni 74:f26e846adfe9 25
ocomeni 74:f26e846adfe9 26 }
ocomeni 74:f26e846adfe9 27
ocomeni 74:f26e846adfe9 28
ocomeni 74:f26e846adfe9 29 // OOB processing
ocomeni 74:f26e846adfe9 30 void ATCmdManager::_process_oob(uint32_t timeout, bool all){
ocomeni 74:f26e846adfe9 31 set_timeout(timeout);
ocomeni 74:f26e846adfe9 32 // Poll for inbound packets
ocomeni 74:f26e846adfe9 33 while (_parser.process_oob() && all) {
ocomeni 74:f26e846adfe9 34 }
ocomeni 74:f26e846adfe9 35 set_timeout();
ocomeni 74:f26e846adfe9 36 }
ocomeni 74:f26e846adfe9 37
ocomeni 74:f26e846adfe9 38
ocomeni 74:f26e846adfe9 39 // OOB message handlers
ocomeni 74:f26e846adfe9 40 void ATCmdManager::_oob_startup_hdlr(){
ocomeni 74:f26e846adfe9 41 }
ocomeni 74:f26e846adfe9 42
ocomeni 74:f26e846adfe9 43
ocomeni 74:f26e846adfe9 44 void ATCmdManager::_oob_bleRole_hdlr(){
ocomeni 74:f26e846adfe9 45 }
ocomeni 74:f26e846adfe9 46
ocomeni 74:f26e846adfe9 47
ocomeni 74:f26e846adfe9 48 void ATCmdManager::_oob_wifiMode_err(){
ocomeni 74:f26e846adfe9 49 }
ocomeni 74:f26e846adfe9 50
ocomeni 74:f26e846adfe9 51
ocomeni 74:f26e846adfe9 52 void ATCmdManager::_oob_conn_already(){
ocomeni 74:f26e846adfe9 53 }
ocomeni 74:f26e846adfe9 54
ocomeni 74:f26e846adfe9 55
ocomeni 74:f26e846adfe9 56 void ATCmdManager::_oob_err(){
ocomeni 74:f26e846adfe9 57 }
ocomeni 74:f26e846adfe9 58
ocomeni 74:f26e846adfe9 59 void ATCmdManager::set_timeout(uint32_t timeout_ms)
ocomeni 74:f26e846adfe9 60 {
ocomeni 74:f26e846adfe9 61 _parser.set_timeout(timeout_ms);
ocomeni 74:f26e846adfe9 62 }
ocomeni 74:f26e846adfe9 63