Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wi-Fi RTTによる屋内測位アプリを作ろう

Wi-Fi RTTによる屋内測位アプリを作ろう

napplecomputer

February 08, 2019
Tweet

More Decks by napplecomputer

Other Decks in Programming

Transcript

  1. 'VTFE-PDBUJPO 12 (14 8J'J 344* ΩϟϦΞج஍ہ 8J'J 355 ਫ਼౓ ϝʔτϧ

    ϝʔτϧ ϝʔτϧʁ ϝʔτϧ ԰಺ ! " " " ҐஔଌҐ༻ " ! ʁ "
  2. 'VTFE-PDBUJPO 13 (14 8J'J 344* ΩϟϦΞج஍ہ 8J'J 355 ਫ਼౓ ϝʔτϧ

    ϝʔτϧ ϝʔτϧʁ ϝʔτϧ ԰಺ ! " " " ҐஔଌҐ༻ " ! ʁ " /&8
  3. ڑ཭ܭଌ΋ͬͱৄ͘͠ 17 ΞΫηεϙΠϯτ ୺຤ '5.3FRVFTU '5. U U "$, U

    U U U ڑ཭ UU  UU ʷޫͷ଎͞ D  ࣌ؒ
  4. 25

  5. 28 x1 y1 r1 x, y (x − x1 )2

    + (y − y1 )2 = r2 1 ϐλΰϥεͷఆཧΛ࢖ͬͯํఔࣜͰදݱ͢Δ
  6. ϐλΰϥεͷఆཧΛ࢖ͬͯํఔࣜͰදݱ͢Δ 29 (x − x1 )2 + (y − y1

    )2 = r2 1 (x − x3 )2 + (y − y3 )2 = r2 3 (x − x2 )2 + (y − y2 )2 = r2 2 (x − x4 )2 + (y − y4 )2 = r2 4
  7. ࣍ํఔࣜΛඳը͢Δ 30 (x − x1 )2 + (y − y1

    )2 = r2 1 (x − x3 )2 + (y − y3 )2 = r2 3 (x − x2 )2 + (y − y2 )2 = r2 2 (x − x4 )2 + (y − y4 )2 = r2 4
  8. ଟ֯ܗͷਅΜதΛ୺຤ͷ৔ॴͱ͢Δ 31 (x − x1 )2 + (y − y1

    )2 = r2 1 (x − x3 )2 + (y − y3 )2 = r2 3 (x − x2 )2 + (y − y2 )2 = r2 2 (x − x4 )2 + (y − y4 )2 = r2 4
  9. 8J'JΞΫηεϙΠϯτΛεΩϟϯ val receiver = object: BroadcastReceiver() { override fun onReceive(context:

    Context, intent: Intent) { when(intent.action) { WifiManager.SCAN_RESULTS_AVAILABLE_ACTION -> { // Wi-FiͷεΩϟϯ͕׬ྃͨ͠ } } } } val filter = IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) registerReceiver(receiver, filter) 37
  10. ΞΫηεϙΠϯτ·Ͱͷڑ཭Λऔಘ val rangingRequest = RangingRequest.Builder() .addAccessPoints(scanResults) .build() val rttManager =

    getSystemService(Context.WIFI_RTT_RANGING_SERVICE) as WifiRttManager val resultCallback = object : RangingResultCallback() { override fun onRangingResults(results: MutableList<RangingResult>) { val ragingResults = results.filter { it.status == STATUS_SUCCESS } } override fun onRangingFailure(code: Int) { } } rttManager.startRanging(rangingRequest, executor, resultCallback) 40
  11. TUBSU4DBOͷ࢓༷มߋ • 8JGJ.BOBHFSTUBSU4DBO ͕"1*-FWFM͔ Β৭ʑมߋ • ಥવͷEFQSFDBUFE • ͔͠΋୅ସखஈ͸ࠓͷͱ͜Ζͳͦ͞͏ •

    όοΫάϥ΢ϯυΞϓϦͰ͸෼ʹճ͔͠ݺ΂ͳ͍ • ϑΥΞάϥ΢ϯυΞϓϦͰ΋෼ʹճ͔͠ݺ΂ͳ͍ 41