Mistake on this page?
Report an issue in GitHub or email us
ControlPlane_netif.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Arm Limited and affiliates.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef CONTROLPLANE_NETIF_H_
18 #define CONTROLPLANE_NETIF_H_
19 
20 #include "nsapi_types.h"
21 
22 /** @file ControlPlane_netif.h
23  * @brief Implements support for data transfer using Control Plane CIoT EPS optimization.
24  *
25  */
26 
27 namespace mbed {
28 
29 /* Length of the buffer storing data received over control plane */
30 #define MAX_CP_DATA_RECV_LEN 2048
31 
32 // TODO: need to make this l3ip compatible
33 
34 /**
35  * @addtogroup cellular
36  * @{
37  */
38 
39 /** Implements support for data transfer using
40  * Control Plane CIoT EPS optimization specified in 3GPP 23.401(4.10), 3GPP 23.682(4.5.14).
41  */
43 public:
45  virtual ~ControlPlane_netif() {}
46 
47 protected:
48  friend class CellularNonIPSocket;
49  friend class CellularContext;
50 
51  /** Send data over cellular control plane
52  *
53  * @param cpdata Buffer of data to be sent over control plane connection
54  * @param cpdata_length Length of data in bytes
55  * @return Number of sent bytes on success, negative error
56  * code on failure.
57  */
58  virtual nsapi_size_or_error_t send(const void *cpdata, nsapi_size_t cpdata_length) = 0;
59 
60  /** Receive data over cellular control plane
61  *
62  * @param cpdata Destination buffer for data received from control plane connection
63  * @param cpdata_length Length of data in bytes
64  * @return Number of received bytes on success, negative error
65  * code on failure.
66  */
67  virtual nsapi_size_or_error_t recv(void *cpdata, nsapi_size_t cpdata_length) = 0;
68 
69  /** Receives data from the control plane PDP context
70  *
71  * This function is called by cellular PDP context when data
72  * is received from network. It will invoke the callback set
73  * by the above attach.
74  *
75  */
76  virtual void data_received() = 0;
77 
78  /** Register a callback on state change of the socket
79  *
80  * The specified callback will be called on state changes such as when
81  * the socket can recv/send successfully and on when an error
82  * occurs. The callback may also be called spuriously without reason.
83  *
84  * The callback may be called in an interrupt context and should not
85  * perform expensive operations such as recv/send calls.
86  *
87  * @param callback Function to call on state change
88  * @param data Argument to pass to callback
89  */
90  virtual void attach(void (*callback)(void *), void *data) = 0;
91 };
92 
93 /**
94  * @}
95  */
96 
97 } // mbed namespace
98 #endif
Implements support for data transfer using Control Plane CIoT EPS optimization specified in 3GPP 23...
virtual void data_received()=0
Receives data from the control plane PDP context.
CellularContext is CellularInterface/NetworkInterface with extensions for cellular connectivity...
virtual nsapi_size_or_error_t recv(void *cpdata, nsapi_size_t cpdata_length)=0
Receive data over cellular control plane.
signed int nsapi_size_or_error_t
Type used to represent either a size or error passed through sockets.
Definition: nsapi_types.h:106
Callback< R(ArgTs...)> callback(R(*func)(ArgTs...)=0)
Create a callback class with type inferred from the arguments.
Definition: Callback.h:709
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
Definition: nsapi_types.h:99
virtual void attach(void(*callback)(void *), void *data)=0
Register a callback on state change of the socket.
virtual nsapi_size_or_error_t send(const void *cpdata, nsapi_size_t cpdata_length)=0
Send data over cellular control plane.
Socket implementation for cellular Non-IP data delivery(NIDD).
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.