diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularinformation/unittest.cmake b/UNITTESTS/features/cellular/framework/AT/at_cellularinformation/unittest.cmake index d908510989..647d4760da 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularinformation/unittest.cmake +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularinformation/unittest.cmake @@ -34,4 +34,10 @@ set(unittest-test-sources stubs/NetworkInterface_stub.cpp stubs/NetworkInterfaceDefaults_stub.cpp stubs/Mutex_stub.cpp + stubs/Semaphore_stub.cpp +) + +set(unittest-test-flags + -DDEVICE_SERIAL=1 + -DDEVICE_INTERRUPTIN=1 ) diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/unittest.cmake b/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/unittest.cmake index 41ff31cd58..7282ec28a7 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/unittest.cmake +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/unittest.cmake @@ -36,4 +36,10 @@ set(unittest-test-sources stubs/randLIB_stub.cpp stubs/ConditionVariable_stub.cpp stubs/Mutex_stub.cpp + stubs/Semaphore_stub.cpp +) + +set(unittest-test-flags + -DDEVICE_SERIAL=1 + -DDEVICE_INTERRUPTIN=1 ) diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularsms/unittest.cmake b/UNITTESTS/features/cellular/framework/AT/at_cellularsms/unittest.cmake index 3e2201be65..5804e5965b 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularsms/unittest.cmake +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularsms/unittest.cmake @@ -37,8 +37,11 @@ set(unittest-test-sources stubs/NetworkInterface_stub.cpp stubs/NetworkInterfaceDefaults_stub.cpp stubs/Mutex_stub.cpp + stubs/Semaphore_stub.cpp ) set(unittest-test-flags -DMBED_CONF_CELLULAR_USE_SMS=1 + -DDEVICE_SERIAL=1 + -DDEVICE_INTERRUPTIN=1 ) diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularstack/unittest.cmake b/UNITTESTS/features/cellular/framework/AT/at_cellularstack/unittest.cmake index aa347bccad..e2a7c71231 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularstack/unittest.cmake +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularstack/unittest.cmake @@ -43,4 +43,11 @@ set(unittest-test-sources stubs/ThisThread_stub.cpp stubs/ConditionVariable_stub.cpp stubs/Mutex_stub.cpp + stubs/Semaphore_stub.cpp ) + +set(unittest-test-flags + -DDEVICE_SERIAL=1 + -DDEVICE_INTERRUPTIN=1 +) + diff --git a/UNITTESTS/stubs/AT_CellularDevice_stub.cpp b/UNITTESTS/stubs/AT_CellularDevice_stub.cpp index 653ee22e6a..7a6d45e2da 100644 --- a/UNITTESTS/stubs/AT_CellularDevice_stub.cpp +++ b/UNITTESTS/stubs/AT_CellularDevice_stub.cpp @@ -32,7 +32,11 @@ int AT_CellularDevice_stub::get_sim_failure_count = 0; bool AT_CellularDevice_stub::pin_needed = false; bool AT_CellularDevice_stub::supported_bool = false; -AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _network(0), _sms(0), +AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), +#if MBED_CONF_CELLULAR_USE_SMS + _sms(0), +#endif // MBED_CONF_CELLULAR_USE_SMS + _network(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT), _modem_debug_on(false) { } @@ -87,12 +91,23 @@ CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh) _modem_debug_on), *this); return _network; } - +#if MBED_CONF_CELLULAR_USE_SMS CellularSMS *AT_CellularDevice::open_sms(FileHandle *fh) { return NULL; } +void AT_CellularDevice::close_sms() +{ +} + +AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at) +{ + return NULL; +} + +#endif // MBED_CONF_CELLULAR_USE_SMS + CellularInformation *AT_CellularDevice::open_information(FileHandle *fh) { return NULL; @@ -108,10 +123,6 @@ void AT_CellularDevice::close_network() } } -void AT_CellularDevice::close_sms() -{ -} - void AT_CellularDevice::close_information() { } @@ -142,11 +153,6 @@ AT_CellularNetwork *AT_CellularDevice::open_network_impl(ATHandler &at) return _network; } -AT_CellularSMS *AT_CellularDevice::open_sms_impl(ATHandler &at) -{ - return NULL; -} - AT_CellularInformation *AT_CellularDevice::open_information_impl(ATHandler &at) { return NULL; diff --git a/UNITTESTS/stubs/CellularDevice_stub.cpp b/UNITTESTS/stubs/CellularDevice_stub.cpp index 86a3b74935..9cc36650a6 100644 --- a/UNITTESTS/stubs/CellularDevice_stub.cpp +++ b/UNITTESTS/stubs/CellularDevice_stub.cpp @@ -37,8 +37,12 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance() } } -CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0), - _info_ref_count(0), _fh(fh), _queue(5 * EVENTS_EVENT_SIZE), _state_machine(0), _nw(0) +CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), +#if MBED_CONF_CELLULAR_USE_SMS + _sms_ref_count(0), +#endif //MBED_CONF_CELLULAR_USE_SMS + _info_ref_count(0), _fh(fh), _queue(10 * EVENTS_EVENT_SIZE), _state_machine(0), + _nw(0), _status_cb(0), _property_array(0) { } diff --git a/UNITTESTS/target_h/myCellularDevice.h b/UNITTESTS/target_h/myCellularDevice.h index b00c8549c8..1078404bc4 100644 --- a/UNITTESTS/target_h/myCellularDevice.h +++ b/UNITTESTS/target_h/myCellularDevice.h @@ -23,6 +23,7 @@ #include "ATHandler_stub.h" #include "AT_CellularContext.h" #include "gtest/gtest.h" +#include "UARTSerial.h" using namespace events;