Arm Mbed OS support forum

Need to shut down the cellular network interface. No API exists

We instantiate a network = NetworkInterface::get_default_instance();
Then the cellular device driver functionality is accessed through this interface.
The network.disconnect() only deactivates the cellular context but we need to explicit shut the modem down through the NetworkInterface API. That is not available. The power on is available through the cellular state machine.
The issue How to reset Cellular network interface?#10912 advises:

NetworkInterface::disconnect(); // disconnect from cellular network and notify to close sockets
CellularDevice::shutdown(); // prepare modem for power off
CellularDevice::soft_power_off(); // switch off modem
CellularDevice::hard_power_off(); // power supply off to cold boot modem
CellularDevice::stop(); // reset cellular state machine
NetworkInterface::connect(); // connect to network and notify sockets can be created again

I am not sure if accessing the CellularDevice object is possible at the same level where we are allocated the NetworkInterface, or that is a clean method.

We had to hack through and cast the returned objects to access the device api calls from the main.cpp that instantiates the network interface.

@trowbridgec

I have this same question/issue. A proper method to do power-off would be much appreciated!

Edit: I found these links in github that are helpful: