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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
RM1000_AT_CellularStack.h
00001 /* 00002 * Copyright (c) 2018, 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 #ifndef RM1000_AT_CELLULARSTACK_H_ 00018 #define RM1000_AT_CELLULARSTACK_H_ 00019 00020 #include "AT_CellularStack.h" 00021 #include "CellularUtil.h" 00022 #include "mbed_wait_api.h" 00023 #include "drivers/Timer.h" 00024 00025 00026 namespace mbed { 00027 00028 class RM1000_AT_CellularStack : public AT_CellularStack { 00029 public: 00030 RM1000_AT_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type, AT_CellularDevice &device); 00031 virtual ~RM1000_AT_CellularStack(); 00032 00033 virtual nsapi_error_t gethostbyname(const char *host, 00034 SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC , const char *interface_name = NULL); 00035 00036 protected: 00037 virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog); 00038 00039 virtual nsapi_error_t socket_accept(nsapi_socket_t server, 00040 nsapi_socket_t *handle, SocketAddress *address = 0); 00041 00042 protected: // AT_CellularStack 00043 00044 /** The profile to use (on board the modem). 00045 */ 00046 #define PROFILE "0" 00047 00048 /** Socket "unused" value. 00049 */ 00050 static const int SOCKET_UNUSED = -1; 00051 00052 /** Socket timeout value in milliseconds. 00053 * Note: the sockets layer above will retry the 00054 * call to the functions here when they return NSAPI_ERROR_WOULD_BLOCK 00055 * and the user has set a larger timeout or full blocking. 00056 */ 00057 static const int SOCKET_TIMEOUT = 1000; 00058 00059 /** Maximum allowed sockets. 00060 */ 00061 static const int RM1000_MAX_SOCKET = 7; 00062 00063 /** The maximum number of bytes in a packet that can be write/read from 00064 * the AT interface in one go. 00065 */ 00066 static const int RM1000_MAX_PACKET_SIZE = 1024; 00067 00068 virtual int get_max_socket_count(); 00069 00070 virtual bool is_protocol_supported(nsapi_protocol_t protocol); 00071 00072 virtual nsapi_error_t create_socket_impl(CellularSocket *socket); 00073 00074 virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address); 00075 00076 virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address, 00077 const void *data, nsapi_size_t size); 00078 00079 virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address, 00080 void *buffer, nsapi_size_t size); 00081 00082 virtual nsapi_error_t socket_close_impl(int sock_id); 00083 00084 private: 00085 // URC handlers 00086 void RUSORCV_URC(); 00087 void RUSOCL_URC(); 00088 00089 /** Clear out the storage for a socket. 00090 * 00091 * @param id Cellular Socket. 00092 * @return None 00093 */ 00094 void clear_socket(CellularSocket *socket); 00095 }; 00096 } // namespace mbed 00097 #endif /* RM1000_AT_CELLULARSTACK_H_ */
Generated on Tue Jul 12 2022 13:54:47 by
