Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
self.name="Adv Report"
self.payload=[EnumByte("ev type",0,{0:"generic adv", 3:"no connection adv", 4:"scan rsp"}),
EnumByte("addr type",0,{0:"public", 1:"random"}),
MACAddr("peer"),UIntByte("length")]
def __init__(self,scan_type=0x1,interval=10, window=750, oaddr_type=0,filter=0):
super(self.__class__, self).__init__(b"\x08",b"\x0b")
self.payload.append(EnumByte("scan type",scan_type,
{0: "Passive",
1: "Active"}))
self.payload.append(UShortInt("Interval",int(round(min(10240,max(2.5,interval))/0.625)),endian="little"))
self.payload.append(UShortInt("Window",int(round(min(10240,max(2.5,min(interval,window)))/0.625)),endian="little"))
self.payload.append(EnumByte("own addresss type",oaddr_type,
{0: "Public",
1: "Random",
2: "Private IRK or Public",
3: "Private IRK or Random"}))
self.payload.append(EnumByte("filter policy",filter,
{0: "None",
1: "Sender In White List",
2: "Almost None",
3: "SIWL and some"}))
def __init__(self,interval_min=500, interval_max=750,
adv_type=0x3, oaddr_type=0, paddr_type=0,
peer_addr="00:00:00:00:00:00", cmap=0x7, filter=0):
super(self.__class__, self).__init__(b"\x08",b"\x06")
self.payload.append(UShortInt("Adv minimum",int(round(min(10240,max(20,interval_min))/0.625)),endian="little"))
self.payload.append(UShortInt("Adv maximum",int(round(min(10240,max(20,max(interval_min,interval_max)))/0.625)),endian="little"))
self.payload.append(EnumByte("adv type",adv_type,
{0: "ADV_IND",
1: "ADV_DIRECT_IND high",
2: "ADV_SCAN_IND",
3: "ADV_NONCONN_IND",
4: "ADV_DIRECT_IND low"}))
self.payload.append(EnumByte("own addresss type",paddr_type,
{0: "Public",
1: "Random",
2: "Private IRK or Public",
3: "Private IRK or Random"}))
self.payload.append(EnumByte("peer addresss type",oaddr_type,
{0: "Public",
1: "Random"}))
self.payload.append(MACAddr("peer",mac=peer_addr))
self.payload.append(BitFieldByte("Channels",cmap,["Channel 37","Channel 38","Channel 39","RFU","RFU","RFU","RFU", "RFU"]))
super(self.__class__, self).__init__(b"\x08",b"\x06")
self.payload.append(UShortInt("Adv minimum",int(round(min(10240,max(20,interval_min))/0.625)),endian="little"))
self.payload.append(UShortInt("Adv maximum",int(round(min(10240,max(20,max(interval_min,interval_max)))/0.625)),endian="little"))
self.payload.append(EnumByte("adv type",adv_type,
{0: "ADV_IND",
1: "ADV_DIRECT_IND high",
2: "ADV_SCAN_IND",
3: "ADV_NONCONN_IND",
4: "ADV_DIRECT_IND low"}))
self.payload.append(EnumByte("own addresss type",paddr_type,
{0: "Public",
1: "Random",
2: "Private IRK or Public",
3: "Private IRK or Random"}))
self.payload.append(EnumByte("peer addresss type",oaddr_type,
{0: "Public",
1: "Random"}))
self.payload.append(MACAddr("peer",mac=peer_addr))
self.payload.append(BitFieldByte("Channels",cmap,["Channel 37","Channel 38","Channel 39","RFU","RFU","RFU","RFU", "RFU"]))
self.payload.append(EnumByte("filter policy",filter,
{0: "None",
1: "Scan",
2: "Connection",
3: "Scan and Connection"}))
def __init__(self,scan_type=0x1,interval=10, window=750, oaddr_type=0,filter=0):
super(self.__class__, self).__init__(b"\x08",b"\x0b")
self.payload.append(EnumByte("scan type",scan_type,
{0: "Passive",
1: "Active"}))
self.payload.append(UShortInt("Interval",int(round(min(10240,max(2.5,interval))/0.625)),endian="little"))
self.payload.append(UShortInt("Window",int(round(min(10240,max(2.5,min(interval,window)))/0.625)),endian="little"))
self.payload.append(EnumByte("own addresss type",oaddr_type,
{0: "Public",
1: "Random",
2: "Private IRK or Public",
3: "Private IRK or Random"}))
self.payload.append(EnumByte("filter policy",filter,
{0: "None",
1: "Sender In White List",
2: "Almost None",
3: "SIWL and some"}))
def __init__(self):
self.name="Adv Report"
self.payload=[EnumByte("ev type",0,{0:"generic adv", 3:"no connection adv", 4:"scan rsp"}),
EnumByte("addr type",0,{0:"public", 1:"random"}),
MACAddr("peer"),UIntByte("length")]
1: "ADV_DIRECT_IND high",
2: "ADV_SCAN_IND",
3: "ADV_NONCONN_IND",
4: "ADV_DIRECT_IND low"}))
self.payload.append(EnumByte("own addresss type",paddr_type,
{0: "Public",
1: "Random",
2: "Private IRK or Public",
3: "Private IRK or Random"}))
self.payload.append(EnumByte("peer addresss type",oaddr_type,
{0: "Public",
1: "Random"}))
self.payload.append(MACAddr("peer",mac=peer_addr))
self.payload.append(BitFieldByte("Channels",cmap,["Channel 37","Channel 38","Channel 39","RFU","RFU","RFU","RFU", "RFU"]))
self.payload.append(EnumByte("filter policy",filter,
{0: "None",
1: "Scan",
2: "Connection",
3: "Scan and Connection"}))
def __init__(self):
self.type= EnumByte("type", 0, {
0x01: "flags",
0x02: "incomplete_list_16_bit_svc_uuids",
0x03: "complete_list_16_bit_svc_uuids",
0x04: "incomplete_list_32_bit_svc_uuids",
0x05: "complete_list_32_bit_svc_uuids",
0x06: "incomplete_list_128_bit_svc_uuids",
0x07: "complete_list_128_bit_svc_uuids",
0x08: "shortened_local_name",
0x09: "complete_local_name",
0x0a: "tx_power_level",
0x0d: "class_of_device",
0x0e: "simple_pairing_hash",
0x0f: "simple_pairing_rand",
0x10: "sec_mgr_tk",
0x11: "sec_mgr_oob_flags",
0x12: "slave_conn_intvl_range",
def __init__(self,interval_min=500, interval_max=750,
adv_type=0x3, oaddr_type=0, paddr_type=0,
peer_addr="00:00:00:00:00:00", cmap=0x7, filter=0):
super(self.__class__, self).__init__(b"\x08",b"\x06")
self.payload.append(UShortInt("Adv minimum",int(round(min(10240,max(20,interval_min))/0.625)),endian="little"))
self.payload.append(UShortInt("Adv maximum",int(round(min(10240,max(20,max(interval_min,interval_max)))/0.625)),endian="little"))
self.payload.append(EnumByte("adv type",adv_type,
{0: "ADV_IND",
1: "ADV_DIRECT_IND high",
2: "ADV_SCAN_IND",
3: "ADV_NONCONN_IND",
4: "ADV_DIRECT_IND low"}))
self.payload.append(EnumByte("own addresss type",paddr_type,
{0: "Public",
1: "Random",
2: "Private IRK or Public",
3: "Private IRK or Random"}))
self.payload.append(EnumByte("peer addresss type",oaddr_type,
{0: "Public",
1: "Random"}))
self.payload.append(MACAddr("peer",mac=peer_addr))
self.payload.append(BitFieldByte("Channels",cmap,["Channel 37","Channel 38","Channel 39","RFU","RFU","RFU","RFU", "RFU"]))
self.payload.append(EnumByte("filter policy",filter,
{0: "None",
1: "Scan",
2: "Connection",
3: "Scan and Connection"}))