WPS NFC: nfcpy script to use new connection handover design

Fetch a carrier record from wpa_supplicant instead of full handover
request. This makes it easier for external programs to build handover
request messages with multiple alternative carriers.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-11-29 12:59:26 +02:00 committed by Jouni Malinen
parent 6202500f6f
commit c209dd1108

View file

@ -10,7 +10,6 @@ import os
import sys
import time
import random
import StringIO
import threading
import argparse
@ -164,16 +163,11 @@ def wps_handover_init(llc):
print "Could not get handover request carrier record from wpa_supplicant"
return
print "Handover request carrier record from wpa_supplicant: " + data.encode("hex")
record = nfc.ndef.Record()
f = StringIO.StringIO(data)
record._read(f)
record = nfc.ndef.HandoverCarrierRecord(record)
print "Parsed handover request carrier record:"
print record.pretty()
message = nfc.ndef.HandoverRequestMessage(version="1.2")
message.nonce = random.randint(0, 0xffff)
message.add_carrier(record, "active")
datamsg = nfc.ndef.Message(data)
message.add_carrier(datamsg[0], "active", datamsg[1:])
print "Handover request:"
print message.pretty()