Skip to content

UBLOX cellular api's for UDP and TCP #7619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions features/cellular/TESTS/api/cellular_network/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ static void test_detach()
TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED);

TEST_ASSERT(nw->detach() == NSAPI_ERROR_OK);
// wait to process URC's, received after detach
rtos::Thread::wait(50);
st = nw->get_connection_status();
TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED);
}
Expand Down
1 change: 1 addition & 0 deletions features/cellular/framework/AT/AT_CellularStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class AT_CellularStack : public NetworkStack, public AT_CellularBase
bool started; // socket has been opened on modem stack
bool tx_ready; // socket is ready for sending on modem stack
bool rx_avail; // socket has data for reading on modem stack
nsapi_size_t pending_bytes; // The number of received bytes pending
};

/**
Expand Down
4 changes: 4 additions & 0 deletions features/cellular/framework/common/CellularTargets.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ namespace mbed {
#elif TARGET_MTB_MTS_DRAGONFLY
#define CELLULAR_DEVICE TELIT_HE910
#elif TARGET_UBLOX_C030
#ifdef TARGET_UBLOX_C030_N211
#define CELLULAR_DEVICE UBLOX_AT
#else
#define CELLULAR_DEVICE UBLOX_PPP
#endif
#elif TARGET_UBLOX_C027
#define CELLULAR_DEVICE UBLOX_PPP
#else
Expand Down
59 changes: 59 additions & 0 deletions features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "UBLOX_AT.h"
#include "UBLOX_AT_CellularNetwork.h"
#include "UBLOX_AT_CellularPower.h"

using namespace mbed;
using namespace events;

UBLOX_AT::UBLOX_AT(EventQueue &queue) : AT_CellularDevice(queue)
{
}

UBLOX_AT::~UBLOX_AT()
{
}

CellularNetwork *UBLOX_AT::open_network(FileHandle *fh)
{
if (!_network) {
ATHandler *atHandler = get_at_handler(fh);
if (atHandler) {
_network = new UBLOX_AT_CellularNetwork(*atHandler);
if (!_network) {
release_at_handler(atHandler);
}
}
}
return _network;
}

CellularPower *UBLOX_AT::open_power(FileHandle *fh)
{
if (!_power) {
ATHandler *atHandler = get_at_handler(fh);
if (atHandler) {
_power = new UBLOX_AT_CellularPower(*atHandler);
if (!_power) {
release_at_handler(atHandler);
}
}
}
return _power;
}
43 changes: 43 additions & 0 deletions features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2018, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef UBLOX_AT_H_
#define UBLOX_AT_H_

#include "AT_CellularDevice.h"

namespace mbed
{

class UBLOX_AT : public AT_CellularDevice
{

public:
UBLOX_AT(events::EventQueue &queue);
virtual ~UBLOX_AT();

public: // CellularDevice
virtual CellularNetwork *open_network(FileHandle *fh);
virtual CellularPower *open_power(FileHandle *fh);

public: // NetworkInterface
void handle_urc(FileHandle *fh);
};

} // namespace mbed

#endif // UBLOX_AT_H_
Loading