00001 import struct 00002 from BAL.protocol.packages.header import TakeoverHeader 00003 00004 CLIB_STATUS = 4 00005 00006 SAVE = 1 00007 CANCEL = 2 00008 RESET = 3 00009 00010 00011 class ClibStatus(TakeoverHeader): 00012 def __init__(self, status): 00013 super(ClibStatus, self).__init__(CLIB_STATUS) 00014 self._status = status 00015 00016 self.set_checksum(self.cal_checksum()) 00017 00018 def get_status(self): 00019 return self._status 00020 00021 def to_bytes(self): 00022 return super(ClibStatus, self).to_bytes() \ 00023 + struct.pack('<B', self._status) 00024 00025