From 410e87e2828616e8e02627b60c9af5344b9249e1 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 8 Jan 2018 14:16:05 -0800 Subject: mpm: Add API call for claim and unclaim These are hooks that the RPC server calls into when claiming a device, and allow the device implementation to trigger user-definable actions on claiming/unclaiming. --- mpm/python/usrp_mpm/periph_manager/base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mpm/python/usrp_mpm/periph_manager/base.py') diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index beba6fef0..474180c31 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -685,3 +685,21 @@ class PeriphManagerBase(object): - src_port: IP port the connection is coming from. """ raise NotImplementedError("commit_xport() not implemented.") + + ####################################################################### + # Claimer API + ####################################################################### + def claim(self): + """ + This is called when the device is claimed, in case the device needs to + run any actions on claiming (e.g., light up an LED). + """ + self.log.debug("Device was claimed. No actions defined.") + + def unclaim(self): + """ + This is called when the device is unclaimed, in case the device needs + to run any actions on claiming (e.g., turn off an LED). + """ + self.log.debug("Device was unclaimed. No actions defined.") + -- cgit v1.2.3