Skip to content

Commit a8abecc

Browse files
UBLOX cellular api's for UDP and TCP
1 parent b170e1c commit a8abecc

File tree

11 files changed

+1340
-1
lines changed

11 files changed

+1340
-1
lines changed

features/cellular/framework/AT/AT_CellularStack.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class AT_CellularStack : public NetworkStack, public AT_CellularBase
9898
bool started; // socket has been opened on modem stack
9999
bool tx_ready; // socket is ready for sending on modem stack
100100
bool rx_avail; // socket has data for reading on modem stack
101+
volatile nsapi_size_t pending_bytes; // The number of received bytes pending
101102
};
102103

103104
/**

features/cellular/framework/common/CellularTargets.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ namespace mbed {
3030
#elif TARGET_MTB_MTS_DRAGONFLY
3131
#define CELLULAR_DEVICE TELIT_HE910
3232
#elif TARGET_UBLOX_C030
33+
#ifdef TARGET_UBLOX_C030_N211
34+
#define CELLULAR_DEVICE UBLOX_AT
35+
#else
3336
#define CELLULAR_DEVICE UBLOX_PPP
37+
#endif
3438
#elif TARGET_UBLOX_C027
3539
#define CELLULAR_DEVICE UBLOX_PPP
3640
#else
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (c) 2017, 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+
18+
#include "UBLOX_AT.h"
19+
#include "UBLOX_AT_CellularNetwork.h"
20+
#include "UBLOX_AT_CellularPower.h"
21+
22+
using namespace mbed;
23+
using namespace events;
24+
25+
UBLOX_AT::UBLOX_AT(EventQueue &queue) : AT_CellularDevice(queue)
26+
{
27+
}
28+
29+
UBLOX_AT::~UBLOX_AT()
30+
{
31+
}
32+
33+
CellularNetwork *UBLOX_AT::open_network(FileHandle *fh)
34+
{
35+
if (!_network) {
36+
ATHandler *atHandler = get_at_handler(fh);
37+
if (atHandler) {
38+
_network = new UBLOX_AT_CellularNetwork(*atHandler);
39+
if (!_network) {
40+
release_at_handler(atHandler);
41+
}
42+
}
43+
}
44+
return _network;
45+
}
46+
47+
CellularPower *UBLOX_AT::open_power(FileHandle *fh)
48+
{
49+
if (!_power) {
50+
ATHandler *atHandler = get_at_handler(fh);
51+
if (atHandler) {
52+
_power = new UBLOX_AT_CellularPower(*atHandler);
53+
if (!_power) {
54+
release_at_handler(atHandler);
55+
}
56+
}
57+
}
58+
return _power;
59+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2017, 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+
18+
#ifndef UBLOX_AT_H_
19+
#define UBLOX_AT_H_
20+
21+
#include "AT_CellularDevice.h"
22+
23+
namespace mbed {
24+
25+
class UBLOX_AT : public AT_CellularDevice
26+
{
27+
28+
public:
29+
UBLOX_AT(events::EventQueue &queue);
30+
virtual ~UBLOX_AT();
31+
32+
public: // CellularDevice
33+
virtual CellularNetwork *open_network(FileHandle *fh);
34+
virtual CellularPower *open_power(FileHandle *fh);
35+
36+
public: // NetworkInterface
37+
void handle_urc(FileHandle *fh);
38+
};
39+
40+
} // namespace mbed
41+
42+
#endif // UBLOX_AT_H_

0 commit comments

Comments
 (0)