mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: review fixes for cellularinformation tests.
parent
8624765c06
commit
f64c84b1b7
|
@ -75,23 +75,26 @@ static void init_to_sim_state()
|
||||||
static void test_information_interface()
|
static void test_information_interface()
|
||||||
{
|
{
|
||||||
CellularInformation *info = cellular.get_device()->open_information(&cellular_serial);
|
CellularInformation *info = cellular.get_device()->open_information(&cellular_serial);
|
||||||
|
const int kbuf_size = 100;
|
||||||
|
char *buf = (char*)malloc(sizeof(char) * kbuf_size);
|
||||||
|
|
||||||
char buf[100];
|
TEST_ASSERT(info->get_manufacturer(buf, kbuf_size) == NSAPI_ERROR_OK);
|
||||||
TEST_ASSERT(info->get_manufacturer(buf, 100) == NSAPI_ERROR_OK);
|
TEST_ASSERT(info->get_model(buf, kbuf_size) == NSAPI_ERROR_OK);
|
||||||
TEST_ASSERT(info->get_model(buf, 100) == NSAPI_ERROR_OK);
|
TEST_ASSERT(info->get_revision(buf, kbuf_size) == NSAPI_ERROR_OK);
|
||||||
TEST_ASSERT(info->get_revision(buf, 100) == NSAPI_ERROR_OK);
|
TEST_ASSERT(info->get_serial_number(buf, kbuf_size, CellularInformation::SN) == NSAPI_ERROR_OK);
|
||||||
TEST_ASSERT(info->get_serial_number(buf, 100, CellularInformation::SN) == NSAPI_ERROR_OK);
|
|
||||||
|
|
||||||
nsapi_error_t err = info->get_serial_number(buf, 100, CellularInformation::IMEI);
|
nsapi_error_t err = info->get_serial_number(buf, kbuf_size, CellularInformation::IMEI);
|
||||||
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
|
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
|
||||||
|
|
||||||
err = info->get_serial_number(buf, 100, CellularInformation::IMEISV);
|
err = info->get_serial_number(buf, kbuf_size, CellularInformation::IMEISV);
|
||||||
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
|
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
|
||||||
|
|
||||||
err = info->get_serial_number(buf, 100, CellularInformation::SVN);
|
err = info->get_serial_number(buf, kbuf_size, CellularInformation::SVN);
|
||||||
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
|
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);
|
||||||
|
|
||||||
cellular.get_device()->close_information();
|
cellular.get_device()->close_information();
|
||||||
|
|
||||||
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
|
@ -30,20 +30,20 @@ AT_CellularInformation::~AT_CellularInformation()
|
||||||
|
|
||||||
nsapi_error_t AT_CellularInformation::get_manufacturer(char *buf, size_t buf_size)
|
nsapi_error_t AT_CellularInformation::get_manufacturer(char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
return 0;
|
return NSAPI_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsapi_error_t AT_CellularInformation::get_model(char *buf, size_t buf_size)
|
nsapi_error_t AT_CellularInformation::get_model(char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
return 0;
|
return NSAPI_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsapi_error_t AT_CellularInformation::get_revision(char *buf, size_t buf_size)
|
nsapi_error_t AT_CellularInformation::get_revision(char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
return 0;
|
return NSAPI_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsapi_error_t AT_CellularInformation::get_serial_number(char *buf, size_t buf_size, SerialNumberType type)
|
nsapi_error_t AT_CellularInformation::get_serial_number(char *buf, size_t buf_size, SerialNumberType type)
|
||||||
{
|
{
|
||||||
return 0;
|
return NSAPI_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue