예제 #1
0
 def test_dispatch_connect_by_name(self, llc, dlc):
     llc.dispatch(nfc.llcp.pdu.Connect(1, 32, sn=b'urn:nfc:sn:service'))
     assert llc.collect() == nfc.llcp.pdu.DisconnectedMode(32, 1, 2)
     llc.bind(dlc, b'urn:nfc:sn:service')
     llc.listen(dlc, 1)
     llc.dispatch(nfc.llcp.pdu.Connect(1, 32, sn=b'urn:nfc:sn:service'))
     llc.accept(dlc)
     assert llc.collect() == nfc.llcp.pdu.ConnectionComplete(32, 16)
예제 #2
0
 def test_dispatch_connect_by_name(self, llc, dlc):
     llc.dispatch(nfc.llcp.pdu.Connect(1, 32, sn=b'urn:nfc:sn:service'))
     assert llc.collect() == nfc.llcp.pdu.DisconnectedMode(32, 1, 2)
     llc.bind(dlc, b'urn:nfc:sn:service')
     llc.listen(dlc, 1)
     llc.dispatch(nfc.llcp.pdu.Connect(1, 32, sn=b'urn:nfc:sn:service'))
     llc.accept(dlc)
     assert llc.collect() == nfc.llcp.pdu.ConnectionComplete(32, 16)
예제 #3
0
 def test_accept_send_cc(self, llc, dlc):
     llc.bind(dlc, b'urn:nfc:sn:snep')
     llc.listen(dlc, 0)
     threading.Timer(0, llc.accept, (dlc,)).start()
     time.sleep(0.01)
     llc.dispatch(nfc.llcp.pdu.Connect(4, 32))
     pdu = llc.collect(0.01)
     assert isinstance(pdu, nfc.llcp.pdu.ConnectionComplete)
     assert pdu.dsap == 32 and pdu.ssap == 4
예제 #4
0
 def test_accept_send_cc(self, llc, dlc):
     llc.bind(dlc, b'urn:nfc:sn:snep')
     llc.listen(dlc, 0)
     threading.Timer(0, llc.accept, (dlc,)).start()
     time.sleep(0.01)
     llc.dispatch(nfc.llcp.pdu.Connect(4, 32))
     pdu = llc.collect(0.01)
     assert isinstance(pdu, nfc.llcp.pdu.ConnectionComplete)
     assert pdu.dsap == 32 and pdu.ssap == 4
예제 #5
0
 def collect_and_dispatch(llc):
     tid = llc.collect().sdreq[0][0]
     pdu = nfc.llcp.pdu.ServiceNameLookup(1, 1, sdres=[(tid, sap)])
     llc.dispatch(pdu)
예제 #6
0
 def test_dispatch_to_inactive_sap(self, llc):
     llc.dispatch(nfc.llcp.pdu.UnnumberedInformation(63, 63))
예제 #7
0
 def test_dispatch_aggregated_frame(self, llc):
     aggregate = 3 * [nfc.llcp.pdu.Symmetry()]
     llc.dispatch(nfc.llcp.pdu.AggregatedFrame(0, 0, aggregate))
     llc.dispatch(nfc.llcp.pdu.AggregatedFrame(1, 0, aggregate))
예제 #8
0
 def collect_and_dispatch(llc):
     llc.collect()
     llc.dispatch(nfc.llcp.pdu.ConnectionComplete(32, 16, peer_miu))
예제 #9
0
 def collect_and_dispatch(llc):
     tid = llc.collect().sdreq[0][0]
     pdu = nfc.llcp.pdu.ServiceNameLookup(1, 1, sdres=[(tid, sap)])
     llc.dispatch(pdu)
예제 #10
0
 def test_dispatch_to_inactive_sap(self, llc):
     llc.dispatch(nfc.llcp.pdu.UnnumberedInformation(63, 63))
예제 #11
0
 def test_dispatch_aggregated_frame(self, llc):
     aggregate = 3 * [nfc.llcp.pdu.Symmetry()]
     llc.dispatch(nfc.llcp.pdu.AggregatedFrame(0, 0, aggregate))
     llc.dispatch(nfc.llcp.pdu.AggregatedFrame(1, 0, aggregate))
예제 #12
0
 def collect_and_dispatch(llc):
     llc.collect()
     llc.dispatch(nfc.llcp.pdu.ConnectionComplete(32, 16, peer_miu))