From 82331cb97639515f0a5230efd154def3356c360a Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 17 May 2017 00:19:33 -0700 Subject: mpm: Added more methods to SID --- mpm/python/usrp_mpm/mpmtypes.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mpm') 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, + ) + -- cgit v1.2.3