Skip to content

Commit 761e01f

Browse files
author
Ari Parkkila
committed
Cellular: Gemalto Cinterion support for ELS61
1 parent 9e012c3 commit 761e01f

8 files changed

+844
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
18+
#include "GEMALTO_CINTERION_CellularNetwork.h"
19+
#include "GEMALTO_CINTERION_Module.h"
20+
#include "AT_CellularInformation.h"
21+
#include "GEMALTO_CINTERION.h"
22+
#include "CellularLog.h"
23+
24+
using namespace mbed;
25+
using namespace events;
26+
27+
GEMALTO_CINTERION::GEMALTO_CINTERION(EventQueue &queue) : AT_CellularDevice(queue)
28+
{
29+
}
30+
31+
GEMALTO_CINTERION::~GEMALTO_CINTERION()
32+
{
33+
}
34+
35+
CellularNetwork *GEMALTO_CINTERION::open_network(FileHandle *fh)
36+
{
37+
if (!_network) {
38+
ATHandler *atHandler = get_at_handler(fh);
39+
if (atHandler) {
40+
_network = new GEMALTO_CINTERION_CellularNetwork(*get_at_handler(fh));
41+
if (!_network) {
42+
release_at_handler(atHandler);
43+
}
44+
}
45+
}
46+
return _network;
47+
}
48+
49+
nsapi_error_t GEMALTO_CINTERION::init_module(FileHandle *fh)
50+
{
51+
CellularInformation *information = open_information(fh);
52+
if (!information) {
53+
return NSAPI_ERROR_NO_MEMORY;
54+
}
55+
char model[sizeof("ELS61") + 1]; // sizeof need to be long enough to hold just the model text
56+
nsapi_error_t ret = information->get_model(model, sizeof(model));
57+
close_information();
58+
if (ret != NSAPI_ERROR_OK) {
59+
tr_error("Cellular model not found!");
60+
return NSAPI_ERROR_DEVICE_ERROR;
61+
}
62+
return GEMALTO_CINTERION_Module::detect_model(model);
63+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
18+
#ifndef GEMALTO_CINTERION_H_
19+
#define GEMALTO_CINTERION_H_
20+
21+
#include "AT_CellularDevice.h"
22+
23+
namespace mbed {
24+
25+
class GEMALTO_CINTERION : public AT_CellularDevice {
26+
public:
27+
28+
GEMALTO_CINTERION(events::EventQueue &queue);
29+
virtual ~GEMALTO_CINTERION();
30+
31+
public: // CellularDevice
32+
virtual CellularNetwork *open_network(FileHandle *fh);
33+
virtual nsapi_error_t init_module(FileHandle *fh);
34+
};
35+
36+
} // namespace mbed
37+
38+
#endif // GEMALTO_CINTERION_H_
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
18+
#include "GEMALTO_CINTERION_CellularNetwork.h"
19+
#include "GEMALTO_CINTERION_CellularStack.h"
20+
21+
using namespace mbed;
22+
23+
GEMALTO_CINTERION_CellularNetwork::GEMALTO_CINTERION_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler)
24+
{
25+
}
26+
27+
GEMALTO_CINTERION_CellularNetwork::~GEMALTO_CINTERION_CellularNetwork()
28+
{
29+
}
30+
31+
NetworkStack *GEMALTO_CINTERION_CellularNetwork::get_stack()
32+
{
33+
if (!_stack) {
34+
_stack = new GEMALTO_CINTERION_CellularStack(_at, _apn, _cid, _ip_stack_type);
35+
}
36+
return _stack;
37+
}
38+
39+
bool GEMALTO_CINTERION_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
40+
{
41+
return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
42+
}
43+
44+
bool GEMALTO_CINTERION_CellularNetwork::has_registration(RegistrationType reg_type)
45+
{
46+
return (reg_type == C_REG || reg_type == C_GREG || reg_type == C_EREG);
47+
}
48+
49+
nsapi_error_t GEMALTO_CINTERION_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opsAct)
50+
{
51+
_op_act = RAT_UNKNOWN;
52+
return NSAPI_ERROR_UNSUPPORTED;
53+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
18+
#ifndef GEMALTO_CINTERION_CELLULAR_NETWORK_H_
19+
#define GEMALTO_CINTERION_CELLULAR_NETWORK_H_
20+
21+
#include "AT_CellularNetwork.h"
22+
23+
namespace mbed {
24+
25+
class GEMALTO_CINTERION_CellularNetwork : public AT_CellularNetwork {
26+
public:
27+
GEMALTO_CINTERION_CellularNetwork(ATHandler &atHandler);
28+
virtual ~GEMALTO_CINTERION_CellularNetwork();
29+
30+
protected:
31+
virtual NetworkStack *get_stack();
32+
33+
virtual bool has_registration(RegistrationType reg_type);
34+
35+
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
36+
37+
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opsAct);
38+
};
39+
40+
} // namespace mbed
41+
42+
#endif // GEMALTO_CINTERION_CELLULAR_NETWORK_H_

0 commit comments

Comments
 (0)