研究開発室の馮 志聖(マイク)です。 In this blog, I will describe how the wifi positioning system works, and explain the difficulties and solutions that the wifi positioning system will encounter in the iOS system.
Content
Introduction
Wi-Fi is a family of wireless network protocols, based on the IEEE 802.11 family of standards, which are commonly used for local area networking of devices and Internet access, allowing nearby digital devices to exchange data by radio waves. These are the most widely used computer networks in the world, used globally in home and small office networks to link desktop and laptop computers, tablet computers, smartphones, smart TVs, printers, and smart speakers together and to a wireless router to connect them to the Internet, and in wireless access points in public places like coffee shops, hotels, libraries and airports to provide the public Internet access for mobile devices.
Wi-Fi uses multiple parts of the IEEE 802 protocol family and is designed to interwork seamlessly with its wired sibling Ethernet. Compatible devices can network through wireless access points to each other as well as to wired devices and the Internet. The different versions of Wi-Fi are specified by various IEEE 802.11 protocol standards, with the different radio technologies determining radio bands, and the maximum ranges, and speeds that may be achieved.
IEEE 802 https://en.wikipedia.org/wiki/IEEE_802
Association of Wi-Fi positioning system (WPS) and AR remote instructions system.
This is the previous blog about AR remote instruction.
AR Remote Instructions base on ARKit - フレクトのクラウドblog re:newal
In AR remote instruction, the supporter or the client will have a problem, that is very often unable to find the target location and cannot provide assistance. Almost all locations are indoor environments, such as warehouses or offices.
Therefore, we searched some existing research information to investigate which methods are suitable for find out the target location.
Indoor positioning system (IPS) includes many kinds of methods. And we talk about the Indoor positioning system (IPS) in the previous blog. It explains in detail how to use iBeacon as IPS auxiliary positioning.
https://cloud.flect.co.jp/entry/2021/03/31/101614
The other method name is the Wi-Fi positioning system.
The previous blog did not include the Wi-Fi positioning system information. So this time I will talk about WPS (Wi-Fi positioning system) on iOS.
WPS (Wi-Fi positioning system)
Purpose
The purpose of the positioning system is to find the target.
Sample use case:
In the figure, the left side is the customer, and the right side is the supporter. The supporter wants to assist the customer remotely and uses model 1 as the target device. However, there are many devices that look the same in the customer's environment, and the customer does not know which one is the target device of model 1. There are more than 2 WiFi devices in the customer's environment.
So we create a positioning system to help the client to find the target.
Positioning methods
Trilateration positioning
Trilateration positioning uses computed distances between several emitters and a receiver to compute the position of the latter. Distances are determined by RSSI. RSSI stands for Relative Received Signal Strength Indication. It allows distance calculation based on radio wave attenuation which follows the Inverse-Square Physical Law.
From this figure, it can be seen that the user's mobile phone is in the middle of the three electric towers, and each electric tower has its own coordinates (x,y). The location of the user is calculated from the signal distance d of the three electric towers.
This figure and part of the description are for reference to the following linked website: https://www.mapwize.io/blog/how-does-indoor-positioning-work/ https://www.avsystem.com/blog/indoor-navigation-and-indoor-positioning/
Fingerprinting positioning
Fingerprinting positioning technologies use signal measurements across buildings to compute one’s position. It is based on the assumption that for every position there is an almost unique signal that can be recorded.
In the figure, you can see that the user's mobile phone receives signals from AP-1 to AP-n, collects the signal strength values to the server, and then analyzes the user's location through algorithms.
This figure and part of the description are for reference to the following linked website: https://www.researchgate.net/figure/Illustration-of-Wi-Fi-fingerprint-based-indoor-positioning-system_fig1_331020073
System
WiFi-Based Systems on iOS
From this figure, you can see that there are three access points (A, B, and C) in different locations in this area. When user A enters this area, each access point's signal value is used to calculate the user's location and guide the user to the destination location. User A will move from position 1 on the left to the destination position 3 on the right. During this process, the three APs will assist the user and give suggested paths.
Why guide the user to the destination location?
For example, the user needs to arrive at the destination and perform on-site maintenance operations. Sometimes it takes a lot of time to find the route. With the help of the auxiliary equipment AP, the user can save time during the journey and arrive quickly and efficiently.
WiFi-Based Systems on iOS (DIY) Issue
DIY here means doing it yourself, and also means developing your own program.
Core Location is the main library used to develop navigation functions in ios devices. We will use this library for development.
About Core Location detail will show on this website: https://developer.apple.com/documentation/corelocation
From the figure below, you can see the problems encountered when developing your own library. All the function is included in Core Loaction library. There are two versions:
On the left is the basic function used by the version lower than iOS 13. From top to bottom,
- The SystemConfiguration function is used to query system configuration information.
- CaptiveNetwork is used to query network information.
- CNCopySupportedInterfaces is used to query the information of the network interface.
- CNCopyCurrentNetworkinfo is used to query the available network details.
- SSID and BSSID are used to query the network name.
Among the functions of CNCopyCurrentNetworkInfo, the office has closed and stopped supporting this function.
On the right is the basic function higher than the iOS 13 version. From top to bottom,
- NetworkExtension is used to query network information.
- NEHotspotHelper is used to query information about the help of Internet hotspots.
- supportedNetworkInterfaces is used to query network interface information.
- NEHotspotNetwork is used to query network content information.
- SSID,BSSID,Secure...Used to query network name, security, and detailed content.
In the NEHotspotHelper function, you must pass Apple's review system before you can use this function.
This is the information about CNCopyCurrentNetworkInfo has become deprecated.
Stuart Cheshire is an engineer who works at Apple. He said on WWDC19 :
Now you all know the importance of privacy to Apple. And one of the things we realized is that accessing Wi-Fi information can be used to infer location. So starting now, to access that Wi-Fi information, you will need the same kind of privileges that you need to get other location information.
This figure and part of the description are for reference to the following linked website: https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo https://developer.apple.com/videos/play/wwdc2019/713/
Other: MobileWiFi.framework requires qualification, which cannot be configured without jailbreak.
https://iphonedevwiki.net/index.php/MobileWiFi.framework
WiFi-Based Systems on iOS Apple official
Core Location is the main library used to develop navigation functions in ios devices. We will use this library for development.
About Core Location detail will show on this website: https://developer.apple.com/documentation/corelocation
Apple officially developed IPS and used it on Apple Maps. It is only open to owners of shopping malls or other public places to use and develop. The operation process of this system is as follows:
- Join the Indoor Maps Program
- Create IMDF
- Validate IMDF
- Enable Indoor Positioning
- Integrate with Your App and Website
All the figures and information below are referenced from Apple WWDC2019, link URL: https://developer.apple.com/videos/play/wwdc2019/245/
First I will explain what is IMDF. And next explain about the operation process of this system.
About IMDF
IMDF stands for Indoor Mapping Data Format. IMDF is a data model that is used to describe an indoor space. IMDF is output as a set of GeoJSON files. There are many APIs available to display GeoJSON, making it easy to add indoor maps to your apps or websites. The easiest way to do this is to use MapKit or MapKit JS. Both include APIs for displaying your indoor map in IMDF format on top of Apple Maps.
About IMDF detail will show on this website: https://register.apple.com/resources/imdf/
Join the Indoor Maps Program
In this picture, you can see the Indoor Maps application developed by Apple. First, the developer needs to pass the review mechanism of this tool.
Create IMDF
In this tool, developers can create their own indoor map and set the location of access points and other devices.
Validate IMDF
After the establishment is completed, you can test whether the indoor map is complete and if some areas are duplicated or some devices are in the wrong location, an error message will appear.
Enable Indoor Positioning
We must turn on the WiFi function on ios. And we can enable the indoor positioning function.
The left side of the figure below is the IMDF information, plus the WiFi device assistance in the middle, which is equal to the indoor positioning function on the right.
In this picture, you can see the tool for testing indoor maps developed by Apple. This tool is used to collect and test all device signal data in the indoor map.
After the indoor map is built, it can be tested directly at the actual location. The tester collects all wireless devices' signal values by moving to all the locations in the area.
After collecting the data, test the data of the actual position and the map position again, and correct the deviated data.
Integrate with Your App and Website
We can use the indoor positioning function in the area we created and can integrate this function into an application or web page.
Benefits
If we complete all the above steps, we can directly use the created resources in this library.
At last, we can use Core Location to get information from the indoor map.
This is the data you can get in Core Location.
Standard and significant location updates. Track large or small changes in the user’s current location with a configurable degree of accuracy.
Region monitoring. Monitor distinct regions of interest and generate location events when they enter or leave those regions.
Beacon ranging. Detect and locate nearby beacons.
Compass headings. Report heading changes from the onboard compass.
Conclusion
In this blog, I explain how to build the WPS on ios. The only way is to use Apple's official tool to develop.
Who should join the Indoor Program ?
Because of privacy, Apple only releases the program for the public place.
But we are not public place owners. So we can not use Apple's official tool to develop.
This is why we use iBeacon as IPS auxiliary positioning in the previous blog.
https://cloud.flect.co.jp/entry/2021/03/31/101614
If you are the public place owners, you can use Apple's official tool to develop an indoor positioning system.
Other
Tell us what do you think about our result or anything else that comes to mind.
We welcome all of your comments and suggestions.