Launch Screen.xib
Main.storyboard
-
ViewController
-
containerView
-
locationTextField
-
userController: WKUserContentController
-
WBManager: WBManager // javascript webkit interaction message handler
-
webView: WKWebView
- configuration: WKWebViewConfiguration
- userContentController: WKUserContentController
- handlers: like([String: WKScriptMessageHandler]) = ["bluetooth": WBManager]
- userContentController: WKUserContentController
- configuration: WKWebViewConfiguration
-
viewDidLoad() // sets up WBManager, userController
-
-
View
- subviews [containerView, locationTextField]
-
App Delegate, AppDelegate.swift // does nothing very interesting
WBManager: WKScriptMessageHandler, CBCentralManagerDelegate, WBPopUpPickerViewDelegate
- userContentController(WKUserContentController, WKScriptMessage):
-
WKScriptMessage
- body: oneof(NSNumber, NSString, NSDate, NSArray, NSDictionary, NSNull)
// e.g. ["type": "bluetooth:requestDevice", "callbackID": 0, "data": ["filters": ..., "name": ...]]
- webView: WKWebView
- frameInfo: WKFrameInfo
- name // the handler name
WKFrameInfo - isMainFrame - request: URLRequest - securityOrigin: WKSecurityOrigin
-
message arrives
-
triaged by bluetooth manager
-
handle requestDevice
-
bluetooth manager parks the transaction, from now if more transactions come in for requestDevice they are rejected
- there is only one requestDevice transaction so correlator can be static
-
handle device.connectGATT
- got device UUID
- Console window to make it easier to debug on the device.
- full screen option
- Handle spontaneous disconnects
- Add forward / back buttons. a. disable / enable forward / back buttons depending on whether there is something to go back or forward to.
- Get HTTPS up on website.
- Read characteristics
- clear state after navigation
- gatt server disconnect
- Icon
- rename GATTCharacteristic to RemoteGATTCharacteristic
- Done + Cancel when no devices are in range
- Complete test plan and test
- Push GPS changes to site.
- Remove security exceptions.
- Check version numbers.
- Send to App store.
- bookmarks
- save last location and restore on relaunch, rather than just going to the same place all the time.
- fix open in a new window link bug
- fix base 64 decoding error
- add window.alert.
- Fix allowing selection of any devices using acceptAllDevices flag.
- Fix allowing selection of devices using the "name" filter flag.
- display address and name of device in picker view.
- Address multiple pucks without conflicts
- assume https url scheme in bookmarks window
- Filters with no names or namePrefixes should work.
- ?? Throw requestDevice failure exceptions in the promise not directly.
- native logging window
- iCloud bookmarks
- work with Gordon's IDE
- security contexts
- Characteristics are not de-notified / torn down when device disconnects
- Handling of devices with the same UUIDs (internal / external) is non-existent.
- in BluetoothGATTService.getCharacteristic check we got the correct char UUID back.
- Going back doesn't refresh the page, but state has been lost meaning there's a lack of sync between page and native
- Don't handle filters properly, if you specify
[{namePrefix: "puck", services: ["xyz"]}, {namePrefix: "other", services: ["abc"]}]
this will offer a device with name"puck"
and service"abc"
.
- Device associations with web addresses do not persist on navigation, including page refresh.
- Not clear how attempting to select / use multiple devices is going to work.
- events not propagated
- Descriptors not supported
- Services within services not supported
- no bookmarks
- UUIDs are uppercase in apple land, lower case on the web, sigh.