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

Dependencies:   mbed-http

source/ATCmdManager.cpp

Committer:
ocomeni
Date:
2019-03-10
Revision:
74:f26e846adfe9
Child:
75:08eff6258e1b

File content as of revision 74:f26e846adfe9:

#include "ATCmdManager.h"
#include "common_config.h"

ATCmdManager::ATCmdManager(PinName tx, PinName rx, bool debug)
    :
    _serial(tx, rx, DEFAULT_BAUD_RATE),
    _parser(&_serial)

{ 
// constructor
    _serial.set_baud(DEFAULT_BAUD_RATE);
    _parser.debug_on(debug);
    _parser.set_delimiter("\r\n");
    _parser.oob("ATE0", callback(this, &ATCmdManager::_oob_startup_hdlr));
    printf("\n --- ATCmdManager constructor completed ---\n");
    // AT+UBTLE
}


void ATCmdManager::runMain(){
    while(true){
        _process_oob(UBLOX_ODIN_W2_RECV_TIMEOUT, true);
        wait_ms(MAIN_LOOP_WAIT_TIME_MS); // allow BTLE to be
    }
    
}


// OOB processing
void ATCmdManager::_process_oob(uint32_t timeout, bool all){
    set_timeout(timeout);
    // Poll for inbound packets
    while (_parser.process_oob() && all) {
    }
    set_timeout();
}


// OOB message handlers
void ATCmdManager::_oob_startup_hdlr(){
}


void ATCmdManager::_oob_bleRole_hdlr(){
}


void ATCmdManager::_oob_wifiMode_err(){
}


void ATCmdManager::_oob_conn_already(){
}


void ATCmdManager::_oob_err(){
}

void ATCmdManager::set_timeout(uint32_t timeout_ms)
{
    _parser.set_timeout(timeout_ms);
}