There is a method opt_power_save_mode in AT_CellularPower class. It is responsible for controlling the 3GPP Power Saving Mode. I want to know how function call for this method is to be made? To my understanding, the AT_xxxxx classes are not exposed directly to user application and EasyConnect + ConnectionFSM are using methods from AT_xxxxxx classes but currently AT_CellularPower::opt_power_save_mode is not used by ConnectionFSM. Can someone explain a little?
[X] Question
[ ] Enhancement
[ ] Bug
I suggest adding it in FSM.
Either:
void CellularConnectionFSM::state_init()
{
_power->opt_power_save_mode();
nsapi_error_t err = _power->is_device_ready()
or in init() after _power is available:
nsapi_error_t CellularConnectionFSM::init()
{
_power = _cellularDevice->open_power(_serial);
if (!_power) {
stop();
return NSAPI_ERROR_NO_MEMORY;
}
_power->opt_power_save_mode(...)
Thanks for the answer but it is unclear to me as how this allows the user to control the power saving mode? Looks like it will always be enabled if i call the method from CellularConnectionFSM::state_init() or CellularConnectionFSM::init()
I see. It would be needed to be used independently in the application at any time, right?
I suppose so because not all user applications would want to enable the power saving mode.
Some applications might want to change the power saving mode from time to time.
EasyCellularConnection doesn't provide direct access to opt_power_save_mode(), at the moment. It needs to be enhanced to support this alone or support a mechanism to give direct access to power interface to the application. Would you need a proposal patch for the first solution?
What would be the difference between first and second solution as both will allow user application to control the PSM, is that correct?
Yes, no difference from user's perspective.
Since this commit, the _power object is deleted as soon as the device is ready so i am not sure how either of the solutions can work.
You are right, that is the next problem. I will have to discuss this issue with the team after the holiday ~2 weeks, plan and come up with a full solution to this problem.
A friendly reminder.
One approach is getting access to cellular device and serial from EasyCellularConnection: PR https://github.com/ARMmbed/mbed-os/pull/7795 and through device, access to power/open_power().
EasyCellularConnection *ecc = reinterpret_cast<EasyCellularConnection*>(iface);
CellularPower *power = ecc->get_device()->open_power(ecc->get_serial());
power->opt_power_save_mode(0, 0);
What do you think?
Looks like it does solve the problem. Thank you