aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-05-17 00:19:33 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:03:53 -0800
commit82331cb97639515f0a5230efd154def3356c360a (patch)
tree499f0f8d085ff3947584e98fc49dbb3cf4f8201d /mpm
parent7cc40f9d12a53ef9dfda98047599e79f57a1ca36 (diff)
downloaduhd-82331cb97639515f0a5230efd154def3356c360a.tar.gz
uhd-82331cb97639515f0a5230efd154def3356c360a.tar.bz2
uhd-82331cb97639515f0a5230efd154def3356c360a.zip
mpm: Added more methods to SID
Diffstat (limited to 'mpm')
-rw-r--r--mpm/python/usrp_mpm/mpmtypes.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mpm/python/usrp_mpm/mpmtypes.py b/mpm/python/usrp_mpm/mpmtypes.py
index b1db3efb9..b355e15a1 100644
--- a/mpm/python/usrp_mpm/mpmtypes.py
+++ b/mpm/python/usrp_mpm/mpmtypes.py
@@ -64,7 +64,22 @@ class SID(object):
def set_dst_ep(self, new_addr):
self.dst_ep = new_addr & 0xFF
+ def reversed(self):
+ """
+ Return a reversed SID.
+ """
+ new_sid = SID(self.get())
+ new_sid.src_addr, new_sid.dst_addr = new_sid.dst_addr, new_sid.src_addr
+ new_sid.src_ep, new_sid.dst_ep = new_sid.dst_ep, new_sid.src_ep
+ return new_sid
+
def get(self):
return (self.src_addr << 24) | (self.src_ep << 16) | (self.dst_addr << 8) | self.dst_ep
+ def __repr__(self):
+ return "{:02X}:{:02X}>{:02X}:{:02X}".format(
+ self.src_addr, self.src_ep,
+ self.dst_addr, self.dst_ep,
+ )
+