判定フェーズの位置

parent 6c50dfb9
...@@ -25,7 +25,7 @@ namespace iBeaconScanner ...@@ -25,7 +25,7 @@ namespace iBeaconScanner
/* パラメータ */ /* パラメータ */
public static int A_thresh = 2;//認証可能人数 public static int A_thresh = 2;//認証可能人数
public static double B_thresh = 0.3;//RU率 public static double B_thresh = 0.3;//RU率
public static TimeSpan LIMIT_TIME = new TimeSpan(0, 0, 8);//n秒パケットが取れなければ終了 public static TimeSpan LIMIT_TIME = new TimeSpan(0, 0, 18);//n秒パケットが取れなければ終了
public static short RSSI = -50;//探索範囲 大きいほど狭い public static short RSSI = -50;//探索範囲 大きいほど狭い
static int RUcnt, NUcnt; static int RUcnt, NUcnt;
...@@ -72,7 +72,7 @@ namespace iBeaconScanner ...@@ -72,7 +72,7 @@ namespace iBeaconScanner
await this.Dispatcher.InvokeAsync(() => await this.Dispatcher.InvokeAsync(() =>
{ {
mutex.WaitOne(); //mutex.WaitOne();
Debug.WriteLine($"{sw.Elapsed}");//経過時間 Debug.WriteLine($"{sw.Elapsed}");//経過時間
if (sw.Elapsed > LIMIT_TIME) if (sw.Elapsed > LIMIT_TIME)
...@@ -98,7 +98,7 @@ namespace iBeaconScanner ...@@ -98,7 +98,7 @@ namespace iBeaconScanner
Debug.WriteLine($"{args.Timestamp} RSSI={args.RawSignalStrengthInDBm} BD:{args.BluetoothAddress}"); Debug.WriteLine($"{args.Timestamp} RSSI={args.RawSignalStrengthInDBm} BD:{args.BluetoothAddress}");
// Debug.WriteLine($"{args.AdvertisementType}, {manufacturerData.CompanyId}"); // Debug.WriteLine($"{args.AdvertisementType}, {manufacturerData.CompanyId}");
/* All_uuidリストを作成するフェーズ */ /* All_uuidリストを作成するフェーズ */
using (var reader = DataReader.FromBuffer(manufacturerData.Data)) using (var reader = DataReader.FromBuffer(manufacturerData.Data))
{ {
reader.ByteOrder = ByteOrder.BigEndian;// BigEndian:順方向にパケットを保存 reader.ByteOrder = ByteOrder.BigEndian;// BigEndian:順方向にパケットを保存
...@@ -135,42 +135,38 @@ namespace iBeaconScanner ...@@ -135,42 +135,38 @@ namespace iBeaconScanner
this.listBox.Text = this.listBox.Text + proximity_uuid + "\r\n"; this.listBox.Text = this.listBox.Text + proximity_uuid + "\r\n";
} }
} }
/* All_uuidリストを作成するフェーズ ↑*/
/* 判定フェーズ↓ */ //mutex.ReleaseMutex();
RUcnt = 0; }
foreach (string N in RU_uuid) //RUリストが大きいときは逆の入れ子の方がいいかも
{
if (All_uuid.Contains(N))
{
RUcnt++;
continue;
}
}
NUcnt = All_uuid.Count - RUcnt;
this.RUNUBox.Text = "RU:" + RUcnt + "人, NU:" + NUcnt + "人" + "\r\n";
if (RUcnt >= A_thresh && 1.0 * RUcnt / (RUcnt + NUcnt) >= B_thresh)//安全かどうかの判定 /* 判定フェーズ↓ */
{ RUcnt = 0;
this.textBox.Text = "You are ACCEPTED!!"; foreach (string N in RU_uuid) //RUリストが大きいときは逆の入れ子の方がいいかも
Debug.WriteLine($"You are ACCEPTED!!"); {
} if (All_uuid.Contains(N))
else
{ {
this.textBox.Text = "Input Password"; RUcnt++;
Debug.WriteLine($"Input Password"); continue;
} }
/* 判定フェーズ↑ */ }
NUcnt = All_uuid.Count - RUcnt;
this.RUNUBox.Text = "RU:" + RUcnt + "人, NU:" + NUcnt + "人" + "\r\n";
mutex.ReleaseMutex(); if (RUcnt >= A_thresh && 1.0 * RUcnt / (RUcnt + NUcnt) >= B_thresh)//安全かどうかの判定
{
this.textBox.Text = "You are ACCEPTED!!";
Debug.WriteLine($"You are ACCEPTED!!");
} }
else
{
this.textBox.Text = "Input Password";
Debug.WriteLine($"Input Password");
}
/* 判定フェーズ↑ */
}); });
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment