|
| 1 | +From 7c789f289225ef631952f0ddb8ac46d2d1de9191 Mon Sep 17 00:00:00 2001 |
| 2 | +From: pennam <m.pennasilico@arduino.cc> |
| 3 | +Date: Thu, 14 Nov 2024 15:57:07 +0100 |
| 4 | +Subject: [PATCH] GEMALTO CINTERION: add soft_power_off() and |
| 5 | + soft_reset() |
| 6 | + |
| 7 | +--- |
| 8 | + .../include/cellular/framework/API/CellularDevice.h | 11 +++++++++++ |
| 9 | + .../include/cellular/framework/AT/AT_CellularDevice.h | 2 ++ |
| 10 | + .../source/framework/AT/AT_CellularDevice.cpp | 5 +++++ |
| 11 | + .../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp | 10 ++++++++++ |
| 12 | + .../cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h | 2 ++ |
| 13 | + 5 files changed, 30 insertions(+) |
| 14 | + |
| 15 | +diff --git a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h |
| 16 | +index 0c8d1a2db2..69455e1567 100644 |
| 17 | +--- a/connectivity/cellular/include/cellular/framework/API/CellularDevice.h |
| 18 | ++++ b/connectivity/cellular/include/cellular/framework/API/CellularDevice.h |
| 19 | +@@ -201,6 +201,17 @@ public: //Pure virtual functions |
| 20 | + */ |
| 21 | + virtual nsapi_error_t soft_power_off() = 0; |
| 22 | + |
| 23 | ++ /** Resets the modem via AT command |
| 24 | ++ * |
| 25 | ++ * @remark CellularStateMachine disconnect or destruct does not reset the modem, |
| 26 | ++ * but you need to do that yourself. |
| 27 | ++ * |
| 28 | ++ * @pre You must call shutdown to prepare the modem for reset. |
| 29 | ++ * |
| 30 | ++ * @return NSAPI_ERROR_OK on success |
| 31 | ++ */ |
| 32 | ++ virtual nsapi_error_t soft_reset() = 0; |
| 33 | ++ |
| 34 | + /** Open the SIM card by setting the pin code for SIM. |
| 35 | + * |
| 36 | + * @param sim_pin PIN for the SIM card |
| 37 | +diff --git a/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h b/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h |
| 38 | +index fa011a0968..0006b6c391 100755 |
| 39 | +--- a/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h |
| 40 | ++++ b/connectivity/cellular/include/cellular/framework/AT/AT_CellularDevice.h |
| 41 | +@@ -80,6 +80,8 @@ public: |
| 42 | + |
| 43 | + virtual nsapi_error_t soft_power_off(); |
| 44 | + |
| 45 | ++ virtual nsapi_error_t soft_reset(); |
| 46 | ++ |
| 47 | + virtual nsapi_error_t set_pin(const char *sim_pin); |
| 48 | + |
| 49 | + virtual nsapi_error_t get_sim_state(SimState &state); |
| 50 | +diff --git a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp |
| 51 | +index 3eccc4a5c0..d7dae05aa2 100644 |
| 52 | +--- a/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp |
| 53 | ++++ b/connectivity/cellular/source/framework/AT/AT_CellularDevice.cpp |
| 54 | +@@ -187,6 +187,11 @@ nsapi_error_t AT_CellularDevice::soft_power_off() |
| 55 | + return NSAPI_ERROR_OK; |
| 56 | + } |
| 57 | + |
| 58 | ++nsapi_error_t AT_CellularDevice::soft_reset() |
| 59 | ++{ |
| 60 | ++ return NSAPI_ERROR_OK; |
| 61 | ++} |
| 62 | ++ |
| 63 | + ATHandler *AT_CellularDevice::get_at_handler() |
| 64 | + { |
| 65 | + return &_at; |
| 66 | +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp |
| 67 | +index c00c1880e4..40e74ab98f 100644 |
| 68 | +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp |
| 69 | ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp |
| 70 | +@@ -98,6 +98,16 @@ nsapi_error_t GEMALTO_CINTERION::shutdown() |
| 71 | + return NSAPI_ERROR_OK; |
| 72 | + } |
| 73 | + |
| 74 | ++nsapi_error_t GEMALTO_CINTERION::soft_power_off() |
| 75 | ++{ |
| 76 | ++ return _at.at_cmd_discard("^SMSO=", "fast"); |
| 77 | ++} |
| 78 | ++ |
| 79 | ++nsapi_error_t GEMALTO_CINTERION::soft_reset() |
| 80 | ++{ |
| 81 | ++ return _at.at_cmd_discard("+CFUN", "=1,1"); |
| 82 | ++} |
| 83 | ++ |
| 84 | + GEMALTO_CINTERION::Module GEMALTO_CINTERION::get_module() |
| 85 | + { |
| 86 | + return _module; |
| 87 | +diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h |
| 88 | +index e77078cb49..edc980209e 100644 |
| 89 | +--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h |
| 90 | ++++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION.h |
| 91 | +@@ -56,6 +56,8 @@ protected: // AT_CellularDevice |
| 92 | + protected: |
| 93 | + virtual nsapi_error_t init(); |
| 94 | + virtual nsapi_error_t shutdown(); |
| 95 | ++ virtual nsapi_error_t soft_power_off(); |
| 96 | ++ virtual nsapi_error_t soft_reset(); |
| 97 | + |
| 98 | + private: |
| 99 | + static Module _module; |
| 100 | +-- |
| 101 | +2.45.2 |
| 102 | + |
0 commit comments