Skip to content

Cellular: Add generic cellular modem #9120

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
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions features/cellular/framework/AT/AT_CellularBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class AT_CellularBase {
PROPERTY_AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
PROPERTY_AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
PROPERTY_AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
PROPERTY_IPV4_STACK, // 0 = not supported, 1 = supported
PROPERTY_IPV6_STACK, // 0 = not supported, 1 = supported
PROPERTY_IPV4V6_STACK, // 0 = not supported, 1 = supported
PROPERTY_IPV4_STACK, // 0 = not supported, 1 = supported. Does modem support IPV4?
PROPERTY_IPV6_STACK, // 0 = not supported, 1 = supported. Does modem support IPV6?
PROPERTY_IPV4V6_STACK, // 0 = not supported, 1 = supported. Does modem support dual stack IPV4V6?
PROPERTY_MAX
};

Expand Down
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.
*/

#include "GENERIC_AT3GPP.h"
#include "AT_CellularNetwork.h"

using namespace mbed;

// by default all properties are supported
static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeLAC, // C_EREG
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
AT_CellularNetwork::RegistrationModeLAC, // C_REG
1, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
1, // PROPERTY_IPV6_STACK
1, // PROPERTY_IPV4V6_STACK
};

GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh)
{
AT_CellularBase::set_cellular_properties(cellular_properties);
}

GENERIC_AT3GPP::~GENERIC_AT3GPP()
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 GENERIC_AT3GPP_H_
#define GENERIC_AT3GPP_H_

#include "AT_CellularDevice.h"

namespace mbed {

/**
* Generic Cellular module which can be used as a default module when porting new cellular module.
* GENERIC_AT3GPP uses standard 3GPP AT commands (3GPP TS 27.007 V14.5.0 (2017-09)) to communicate with the modem.
*
* GENERIC_AT3GPP can be used as a shield for example on top K64F.
* Cellular example can be used for testing: https://github.com/ARMmbed/mbed-os-example-cellular
* Add line to mbed_app.json where you define this class as CELLULAR_DEVICE and the correct pins. In cellular example
* line would be for example just above "target_overrides": {...
* For example:
* "macros": ["CELLULAR_DEVICE=GENERIC_AT3GPP", "MDMRXD=PTC16", "MDMTXD=PTC17","MDMRTS=NC", "MDMCTS=NC"],
* You can define CELLULAR_DEVICE and pins also in ../../../common/CellularTargets.h
*
* If new target don't work with GENERIC_AT3GPP then it needs some customizations.
* First thing to try can be checking/modifying cellular_properties array in GENERIC_AT3GPP.cpp, does the module support
* these commands or not? Modify array and if that's not enough then some AT_xxx classes might need to be created and
* methods overridden. Check help how other modules are done what methods they have overridden. Happy porting!
*/
class GENERIC_AT3GPP : public AT_CellularDevice {
public:
GENERIC_AT3GPP(FileHandle *fh);
virtual ~GENERIC_AT3GPP();

};
} // namespace mbed
#endif // GENERIC_AT3GPP_H_
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
AT_CellularNetwork::RegistrationModeLAC, // C_REG
0, // AT_CGSN_WITH_TYPE
1, // AT_CGDATA
0, // AT_CGDATA
1, // AT_CGAUTH
1, // PROPERTY_IPV4_STACK
0, // PROPERTY_IPV6_STACK
Expand Down