A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
tests/test_main.cpp@143:c7d8fe37981b, 2014-01-05 (annotated)
- Committer:
- mfiore
- Date:
- Sun Jan 05 05:49:42 2014 +0000
- Revision:
- 143:c7d8fe37981b
- Parent:
- 141:571e0ef6c8dc
revamp Cellular::init() function; resets the radio to make sure it's in a good state before proceeding; this function waits for the radio to come up, so we don't need to outside; ; update documentation and examples in SocketModem to reflect these changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kranjan | 141:571e0ef6c8dc | 1 | /* Universal Socket Modem Interface Library |
kranjan | 141:571e0ef6c8dc | 2 | * Copyright (c) 2013 Multi-Tech Systems |
kranjan | 141:571e0ef6c8dc | 3 | * |
kranjan | 141:571e0ef6c8dc | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kranjan | 141:571e0ef6c8dc | 5 | * you may not use this file except in compliance with the License. |
kranjan | 141:571e0ef6c8dc | 6 | * You may obtain a copy of the License at |
kranjan | 141:571e0ef6c8dc | 7 | * |
kranjan | 141:571e0ef6c8dc | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kranjan | 141:571e0ef6c8dc | 9 | * |
kranjan | 141:571e0ef6c8dc | 10 | * Unless required by applicable law or agreed to in writing, software |
kranjan | 141:571e0ef6c8dc | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kranjan | 141:571e0ef6c8dc | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kranjan | 141:571e0ef6c8dc | 13 | * See the License for the specific language governing permissions and |
kranjan | 141:571e0ef6c8dc | 14 | * limitations under the License. |
kranjan | 141:571e0ef6c8dc | 15 | */ |
kranjan | 141:571e0ef6c8dc | 16 | |
mfiore | 124:6d964b4343c8 | 17 | #include "mbed.h" |
mfiore | 124:6d964b4343c8 | 18 | #include "include_me.h" |
mfiore | 124:6d964b4343c8 | 19 | |
mfiore | 124:6d964b4343c8 | 20 | // uncomment only the header corresponding to the test you want to run |
mfiore | 124:6d964b4343c8 | 21 | //#include "test_ping.h" |
mfiore | 124:6d964b4343c8 | 22 | //#include "test_SMS.h" |
mfiore | 124:6d964b4343c8 | 23 | //#include "test_TCP_Socket.h" |
mfiore | 124:6d964b4343c8 | 24 | //#include "test_TCP_Socket_Echo.h" |
mfiore | 124:6d964b4343c8 | 25 | //#include "test_MTS_Circular_Buffer.h" |
mfiore | 124:6d964b4343c8 | 26 | |
mfiore | 124:6d964b4343c8 | 27 | |
mfiore | 124:6d964b4343c8 | 28 | //int main() { |
mfiore | 124:6d964b4343c8 | 29 | // uncomment only one test at a time |
mfiore | 124:6d964b4343c8 | 30 | |
mfiore | 124:6d964b4343c8 | 31 | // PING TEST |
mfiore | 124:6d964b4343c8 | 32 | //testPing(); |
mfiore | 124:6d964b4343c8 | 33 | |
mfiore | 124:6d964b4343c8 | 34 | /* |
mfiore | 124:6d964b4343c8 | 35 | // SMS TEST |
mfiore | 124:6d964b4343c8 | 36 | Transport::setTransport(Transport::CELLULAR); |
mfiore | 124:6d964b4343c8 | 37 | MTSSerialFlowControl* serial = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8); |
mfiore | 124:6d964b4343c8 | 38 | serial->baud(115200); |
mfiore | 124:6d964b4343c8 | 39 | Cellular* cell = Cellular::getInstance(); |
mfiore | 124:6d964b4343c8 | 40 | cell->init(serial); |
mfiore | 124:6d964b4343c8 | 41 | while (cell->getRegistration() != Cellular::REGISTERED); |
mfiore | 124:6d964b4343c8 | 42 | while (cell->setApn("wap.cingular") != SUCCESS); |
mfiore | 124:6d964b4343c8 | 43 | |
mfiore | 124:6d964b4343c8 | 44 | sendSms(); |
mfiore | 124:6d964b4343c8 | 45 | while (true) { |
mfiore | 124:6d964b4343c8 | 46 | receiveSms(); |
mfiore | 124:6d964b4343c8 | 47 | wait(15); |
mfiore | 124:6d964b4343c8 | 48 | } |
mfiore | 124:6d964b4343c8 | 49 | */ |
mfiore | 124:6d964b4343c8 | 50 | |
mfiore | 124:6d964b4343c8 | 51 | // TCP SOCKET TEST |
mfiore | 124:6d964b4343c8 | 52 | //testTcpSocket(); |
mfiore | 124:6d964b4343c8 | 53 | |
mfiore | 124:6d964b4343c8 | 54 | // TCP SOCKET ECHO TEST |
mfiore | 124:6d964b4343c8 | 55 | //testTcpSocketEcho(); |
mfiore | 124:6d964b4343c8 | 56 | |
mfiore | 124:6d964b4343c8 | 57 | // CIRCULAR BUFFER TEST |
mfiore | 124:6d964b4343c8 | 58 | //testMTSCircularBuffer(); |
kranjan | 141:571e0ef6c8dc | 59 | //} |