Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
sms.cpp
00001 /* 00002 * Copyright (c) 2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #include "CellularTests.h" 00018 00019 #ifdef CELLULAR_DEVICE 00020 00021 using namespace mbed; 00022 00023 void test_sms_init() 00024 { 00025 // for some weird reason if we don't wait for few seconds we get SIM Busy error in initialize even is SIM is ready... 00026 wait(3); 00027 00028 // check SIM state as we have tested sim and it might not be ready 00029 for (int i = 0; i < MAX_SIM_READY_WAITING_TIME; i++) { 00030 CellularSIM::SimState state; 00031 if (sim->get_sim_state(state) == NSAPI_ERROR_OK && state == CellularSIM::SimStateReady) { 00032 break; 00033 } 00034 wait(1); 00035 } 00036 00037 nsapi_error_t err = sms->initialize(CellularSMS::CellularSMSMmodeText); 00038 char err_msg[60]; 00039 sprintf(err_msg, "SMS initialize failed with: %d", err); 00040 00041 cellularDevice.close_sms(); 00042 sms = NULL; 00043 TEST_ASSERT_MESSAGE(!err, err_msg); 00044 } 00045 00046 #endif // CELLULAR_DEVICE
Generated on Tue Jul 12 2022 14:24:35 by
