def from_data(data): handle = u16(unbits(bits_str(data[0:2])[0:12].rjust(16, "0"))) ps = u8(unbits(bits_str(data[1:2])[4:6].rjust(8, "0"))) return HCI_Sco(handle, ps, u8(data[2]), data[3:])
def getRaw(self): raw = bits(p16(self.handle))[4:] raw.extend(bits(p8(self.ps))[6:]) raw.extend(bits(p8(0))[6:]) raw.extend(bits(p8(self.length))) return super(HCI_Sco, self).getRaw() + unbits(raw) + self.data
def from_data(data): handle = u16(unbits(bits_str(data[0:2])[0:12].rjust(16, "0"))) bp = u8(unbits(bits_str(data[1:2])[4:6].rjust(8, "0"))) bc = u8(unbits(bits_str(data[1:2])[6:8].rjust(8, "0"))) return HCI_Acl(handle, bp, bc, u16(data[2:4]), data[4:])