From f77dd4ea8ba996582777011d21bbc5c538b20808 Mon Sep 17 00:00:00 2001
From: Abdullah Bin Zubair <abdzu618@student.liu.se>
Date: Mon, 5 Dec 2022 13:20:54 +0000
Subject: [PATCH] Updated beacon_1 is the updated beacon code

---
 iroha-drip-general-master/bluetooth/beacon_1.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/iroha-drip-general-master/bluetooth/beacon_1.py b/iroha-drip-general-master/bluetooth/beacon_1.py
index 73c8698..b0ea3b6 100644
--- a/iroha-drip-general-master/bluetooth/beacon_1.py
+++ b/iroha-drip-general-master/bluetooth/beacon_1.py
@@ -79,8 +79,8 @@ def get_auth_pages(signature: bytes, auth_type=0x10):
 
     return auth_pages
 
-
-def location_update(gpsd: GpsPoller, iroha: DripIrohaAccount, flight_id):
+# Placing a single location message For Now 
+def Drip_Wrapper(gpsd: GpsPoller, iroha: DripIrohaAccount, flight_id):
     # ASTM F3-411 Location message 0x1
     print("location_update")
     global executor
@@ -136,7 +136,7 @@ def location_update(gpsd: GpsPoller, iroha: DripIrohaAccount, flight_id):
             "hcitool -i hci0 cmd 0x08 0x0008 1f 1e 16 fa ff 0d 00 10 {payload}".format(payload=payload), shell=True)
 
 
-def manifest_broadcast(payload, flight_id):
+def manifest_broadcast(payload, flight_id): ## Manifest broadcast can contain max  11 hashes (at 8-bytes each). For now we are sending one message.
     # ASTM F3-411 Location message 0x1
     print("manifest_broadcast")
     
@@ -169,7 +169,7 @@ def manifest_broadcast(payload, flight_id):
         Advertising_Data: 1e 16 fa ff 0d 00 10 + payload 
         """
         subprocess.run(
-            "hcitool -i hci0 cmd 0x08 0x0037 0x00 0x03 0x01 0x1f 0x1e 0x16 0xfa 0xff 0x0d 0x00 0x10 {payload}".format(payload=hash_payload), shell=True)
+            "hcitool -i hci0 cmd 0x08 0x0037 0x00 0x03 0x01 0x1f 0x1e 0x16 0xfa 0xff 0x0d 0x00 0x10 {payload}".format(payload=hash_payload), shell=True) #0x03
     else:
         """
         OGF: 0x08  (LE controller commands)
@@ -377,7 +377,7 @@ def main():
     # but just for now, we are generating the r_signature using the same function used for drone signature generate function
    
     
-    attest = hi.generate_self_concise_attestation(get_timestamp(exp_date))
+    attest = hi.generate_self_concise_attestation(r_hhit,r_signature,get_timestamp(exp_date))
     if attest is None:
         print("Expiration date has expired.")
         sys.exit(-1)
@@ -470,8 +470,8 @@ def main():
                 auth_update(auth_pages[2:], 2)
 
             # Location updates at least once every second.
-            location_update(gpsd, iroha, flight_id)
-            
+            Drip_Wrapper(gpsd, iroha, flight_id)
+            # Manifest broadcast 
             manifest_broadcast(payload, flight_id)
             if args.run_scenario:
                 g_lat += random.uniform(0.0001, 0.001) * \
-- 
GitLab