浏览代码

Merge branch 'master' of http://dev.prmsys.net:3001/Viktor/PositionViewer

Виктор Шейко 5 年之前
父节点
当前提交
2718533420
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      Assets/Scripts/Net/Client.cs

+ 6 - 2
Assets/Scripts/Net/Client.cs

@@ -865,8 +865,10 @@ public class Client : MonoBehaviour
     public void BeaconsReceive(byte[] bytedata)
     {
         int read = 5;
+        int num = 0;
         while (read < bytedata.Length)
         {
+            num++;
             var id = BitConverter.ToUInt32(bytedata, read);
             var uuid = Encoding.UTF8.GetString(bytedata, read + 4, 36);
             var x = BitConverter.ToSingle(bytedata, read + 40);
@@ -876,11 +878,13 @@ public class Client : MonoBehaviour
             var major = BitConverter.ToUInt16(bytedata, read + 54);
             var enabled = bytedata[read + 56];
             var lid = BitConverter.ToUInt32(bytedata, read+57);
-            print($"beacon received id {id} uuid {uuid} x {x} y {y} z {z} minor {minor} major {major} enabled {enabled} location {lid}");
-            read += 61;
+            var mac = Encoding.UTF8.GetString(bytedata, read + 61, 17);
+            print($"beacon received id {id} uuid {uuid} x {x} y {y} z {z} minor {minor} major {major} enabled {enabled} location {lid} mac{mac}");
+            read += 78;
 
             PlayerController.Beacons.Add(new Beacon { id = id, location_id = lid, uuid = uuid, x = x, y = y, z = z, minor = minor, major = major, enabled = enabled == 1 ? true : false });
         }
+        print("Beacons loaded: " + num);
         PlayerController.beacons_load = true;
     }