-
Notifications
You must be signed in to change notification settings - Fork 3k
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
UBLOX cellular api's for UDP and TCP #7619
Changes from 1 commit
a8abecc
ffb4f92
122e771
f9aaee5
f512668
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2017, Arm Limited and affiliates. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Years are passing so fast, it's already 2018 :) See also the other files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
* 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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2017, 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated all files. |
||
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_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably use
rx_avail
flag here just to indicate that some data is available because you always read how much data really is available when recveiving? If not then you could change type ofrx_avail
and use it instead of newpending_bytes
variable.There is no need to use volatile here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If rx_avail is unused and nobody else is using it then we can change its type and use it as well.