示例#1
0
 def test_send(self, tco, pdu):
     assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is None
     assert tco.dequeue(1, 0, False) is None
     assert tco.dequeue(10, 4, False) == pdu
     assert tco.dequeue(10, 4) is None
     threading.Timer(0.01, tco.dequeue, (10, 4)).start()
     tco.send(pdu, 0)
示例#2
0
 def test_send(self, tco, pdu):
     assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is None
     assert tco.dequeue(1, 0, False) is None
     assert tco.dequeue(10, 4, False) == pdu
     assert tco.dequeue(10, 4) is None
     threading.Timer(0.01, tco.dequeue, (10, 4)).start()
     tco.send(pdu, 0)
示例#3
0
 def test_send(self, tco):
     pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
     assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is True
     assert tco.dequeue(10, 4) == pdu
     threading.Timer(0.01, tco.dequeue, (10, 4)).start()
     assert tco.send(pdu, 0) is True
     tco.close()
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.send(pdu, 0)
     assert excinfo.value.errno == errno.ESHUTDOWN
示例#4
0
 def test_send(self, tco):
     pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
     assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is True
     assert tco.dequeue(10, 4) == pdu
     threading.Timer(0.01, tco.dequeue, (10, 4)).start()
     assert tco.send(pdu, 0) is True
     tco.close()
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.send(pdu, 0)
     assert excinfo.value.errno == errno.ESHUTDOWN
示例#5
0
 def test_poll(self, tco):
     pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
     assert tco.poll("", 1.0) is None
     assert tco.poll("recv", 0.001) is None
     assert tco.enqueue(pdu) is True
     assert tco.poll("recv", 0.001) == pdu
     assert tco.poll("send", 1.0) is True
     assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is None
     assert tco.poll("send", 0.001) is False
     assert tco.dequeue(10, 4, False) == pdu
     assert tco.poll("send", 1.0) is True
示例#6
0
 def test_poll(self, tco):
     pdu = nfc.llcp.pdu.UnnumberedInformation(1, 1, HEX('1122'))
     assert tco.poll("", 1.0) is None
     assert tco.poll("recv", 0.001) is None
     assert tco.enqueue(pdu) is True
     assert tco.poll("recv", 0.001) == pdu
     assert tco.poll("send", 1.0) is True
     assert tco.send(pdu, flags=nfc.llcp.MSG_DONTWAIT) is None
     assert tco.poll("send", 0.001) is False
     assert tco.dequeue(10, 4, False) == pdu
     assert tco.poll("send", 1.0) is True
示例#7
0
 def test_send_with_error_not_connected(self, tco):
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.send(b'', nfc.llcp.MSG_DONTWAIT)
     assert excinfo.value.errno == errno.ENOTCONN
示例#8
0
 def test_send_with_error_not_connected(self, tco):
     with pytest.raises(nfc.llcp.Error) as excinfo:
         tco.send(b'', nfc.llcp.MSG_DONTWAIT)
     assert excinfo.value.errno == errno.ENOTCONN