Mark,
Am 11.09.20 um 18:11 schrieb Michael Balzer:
I agree it is not necessary; my suggestion is purely to clean it up
and enhance functionality. The problem at the moment is that
OvmsCommand execute callbacks can only be to function callbacks (not
objects). It doesn’t even use the c++ bind function callback
mechanism (like notification, etc, for example). It is what it is,
and changing now is very hard.
That slipped my attention, but upgrading OvmsCommand to accept any
function type should be simply changing m_execute and m_validate to
std::function, or do I miss something?
Just did this locally, works perfectly. Shall I push the change or have
you begun working on ovms_command?
If so, it's really just exchanging the function signatures for these types:
typedef std::function<void(int, OvmsWriter*, OvmsCommand*, int, const
char* const*)> OvmsCommandExecuteCallback_t;
typedef std::function<int(OvmsWriter*, OvmsCommand*, int, const char*
const*, bool)> OvmsCommandValidateCallback_t;
Patch attached.
Regards,
Michael
--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
<ovmscommand.patch>_______________________________________________
OvmsDev mailing list
OvmsDev@lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev