Skip to content

Commit 4b1d087

Browse files
ytsuboiadbridge
authored andcommitted
Adding platform
1 parent a771f04 commit 4b1d087

File tree

15 files changed

+1364
-0
lines changed

15 files changed

+1364
-0
lines changed

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,21 @@ nsapi_error_t AT_CellularNetwork::set_context_to_be_activated()
435435

436436
// if user has defined user name and password we need to call CGAUTH before activating or modifying context
437437
if (_pwd && _uname) {
438+
#if defined(TARGET_WIO_3G)
439+
_at.cmd_start("AT+QICSGP=");
440+
_at.write_int(_cid);
441+
_at.write_int(1); // context type 1=IPv4
442+
_at.write_string(_apn);
443+
_at.write_string(_uname);
444+
_at.write_string(_pwd);
445+
_at.write_int(_authentication_type);
446+
#else
438447
_at.cmd_start("AT+CGAUTH=");
439448
_at.write_int(_cid);
440449
_at.write_int(_authentication_type);
441450
_at.write_string(_uname);
442451
_at.write_string(_pwd);
452+
#endif
443453
_at.cmd_stop();
444454
_at.resp_start();
445455
_at.resp_stop();

features/cellular/framework/common/CellularTargets.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ namespace mbed {
2323
#ifndef CELLULAR_DEVICE
2424
#if defined(TARGET_ADV_WISE_1570) || defined(TARGET_MTB_ADV_WISE_1570)
2525
#define CELLULAR_DEVICE QUECTEL_BC95
26+
#elif TARGET_WIO_3G
27+
#define CELLULAR_DEVICE QUECTEL_UG96
2628
#elif TARGET_MTS_DRAGONFLY_F411RE
2729
#define CELLULAR_DEVICE TELIT_HE910
2830
#elif TARGET_MTB_MTS_DRAGONFLY
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 "QUECTEL/UG96/QUECTEL_UG96.h"
19+
#include "QUECTEL/UG96/QUECTEL_UG96_CellularNetwork.h"
20+
#include "QUECTEL/UG96/QUECTEL_UG96_CellularPower.h"
21+
22+
using namespace mbed;
23+
using namespace events;
24+
25+
#define CONNECT_DELIM "\r\n"
26+
#define CONNECT_BUFFER_SIZE (1280 + 80 + 80) // AT response + sscanf format
27+
#define CONNECT_TIMEOUT 8000
28+
29+
#define MAX_STARTUP_TRIALS 5
30+
#define MAX_RESET_TRIALS 5
31+
32+
QUECTEL_UG96::QUECTEL_UG96(EventQueue &queue) : AT_CellularDevice(queue)
33+
{
34+
}
35+
36+
QUECTEL_UG96::~QUECTEL_UG96()
37+
{
38+
}
39+
40+
CellularNetwork *QUECTEL_UG96::open_network(FileHandle *fh)
41+
{
42+
if (!_network) {
43+
_network = new QUECTEL_UG96_CellularNetwork(*get_at_handler(fh));
44+
}
45+
return _network;
46+
}
47+
48+
CellularPower *QUECTEL_UG96::open_power(FileHandle *fh)
49+
{
50+
if (!_power) {
51+
ATHandler *atHandler = get_at_handler(fh);
52+
if (atHandler) {
53+
_power = new QUECTEL_UG96_CellularPower(*atHandler);
54+
if (!_power) {
55+
release_at_handler(atHandler);
56+
}
57+
}
58+
}
59+
return _power;
60+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 QUECTEL_UG96_H_
19+
#define QUECTEL_UG96_H_
20+
21+
#include "AT_CellularDevice.h"
22+
23+
namespace mbed {
24+
25+
#ifdef TARGET_WIO_3G
26+
#define CELLULAR_SERIAL_TX PA_2
27+
#define CELLULAR_SERIAL_RX PA_3
28+
#else
29+
#define CELLULAR_SERIAL_TX PC_1
30+
#define CELLULAR_SERIAL_RX PC_0
31+
#endif
32+
33+
class QUECTEL_UG96 : public AT_CellularDevice
34+
{
35+
public:
36+
37+
QUECTEL_UG96(events::EventQueue &queue);
38+
virtual ~QUECTEL_UG96();
39+
40+
public: // CellularDevice
41+
virtual CellularNetwork *open_network(FileHandle *fh);
42+
virtual CellularPower *open_power(FileHandle *fh);
43+
44+
public: // NetworkInterface
45+
void handle_urc(FileHandle *fh);
46+
47+
};
48+
49+
} // namespace mbed
50+
#endif // QUECTEL_UG96_H_
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 "QUECTEL/UG96/QUECTEL_UG96_CellularNetwork.h"
19+
20+
using namespace mbed;
21+
22+
QUECTEL_UG96_CellularNetwork::QUECTEL_UG96_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler)
23+
{
24+
}
25+
26+
QUECTEL_UG96_CellularNetwork::~QUECTEL_UG96_CellularNetwork()
27+
{
28+
}
29+
30+
bool QUECTEL_UG96_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
31+
{
32+
return requested_stack == IPV4_STACK ? true : false;
33+
}
34+
35+
bool QUECTEL_UG96_CellularNetwork::has_registration(RegistrationType reg_type)
36+
{
37+
return (reg_type == C_REG || reg_type == C_GREG);
38+
}
39+
40+
nsapi_error_t QUECTEL_UG96_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opRat)
41+
{
42+
_op_act = RAT_UNKNOWN;
43+
return NSAPI_ERROR_UNSUPPORTED;
44+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 QUECTEL_UG96_CELLULAR_NETWORK_H_
19+
#define QUECTEL_UG96_CELLULAR_NETWORK_H_
20+
21+
#include "AT_CellularNetwork.h"
22+
23+
namespace mbed {
24+
25+
class QUECTEL_UG96_CellularNetwork : public AT_CellularNetwork
26+
{
27+
public:
28+
QUECTEL_UG96_CellularNetwork(ATHandler &atHandler);
29+
virtual ~QUECTEL_UG96_CellularNetwork();
30+
31+
protected:
32+
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
33+
34+
virtual bool has_registration(RegistrationType rat);
35+
36+
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
37+
};
38+
39+
} // namespace mbed
40+
41+
#endif // QUECTEL_UG96_CELLULAR_NETWORK_H_
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 "QUECTEL_UG96_CellularPower.h"
19+
20+
#include "onboard_modem_api.h"
21+
22+
using namespace mbed;
23+
24+
QUECTEL_UG96_CellularPower::QUECTEL_UG96_CellularPower(ATHandler &atHandler) : AT_CellularPower(atHandler)
25+
{
26+
27+
}
28+
29+
QUECTEL_UG96_CellularPower::~QUECTEL_UG96_CellularPower()
30+
{
31+
32+
}
33+
34+
nsapi_error_t QUECTEL_UG96_CellularPower::on()
35+
{
36+
#if MODEM_ON_BOARD
37+
::onboard_modem_init();
38+
::onboard_modem_power_up();
39+
#endif
40+
return NSAPI_ERROR_OK;
41+
}
42+
43+
nsapi_error_t QUECTEL_UG96_CellularPower::off()
44+
{
45+
#if MODEM_ON_BOARD
46+
::onboard_modem_power_down();
47+
#endif
48+
return NSAPI_ERROR_OK;
49+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 QUECTEL_UG96_CELLULARPOWER_H_
19+
#define QUECTEL_UG96_CELLULARPOWER_H_
20+
21+
#include "AT_CellularPower.h"
22+
23+
namespace mbed {
24+
25+
class QUECTEL_UG96_CellularPower : public AT_CellularPower
26+
{
27+
public:
28+
QUECTEL_UG96_CellularPower(ATHandler &atHandler);
29+
virtual ~QUECTEL_UG96_CellularPower();
30+
31+
public: //from CellularPower
32+
33+
virtual nsapi_error_t on();
34+
35+
virtual nsapi_error_t off();
36+
};
37+
38+
} // namespace mbed
39+
40+
#endif // QUECTEL_UG96_CELLULARPOWER_H_

0 commit comments

Comments
 (0)