Appearance
Protocols
Supersonic device communication protocols.
Overview
Supersonic currently uses a 3 tiered structure for communication with low level devices.
- Generic Client Protocol Interface (
@fingermarkglobal/protocolsclients) - Platform Message Bus (For current chrome usage,
@fingermarkglobal/chrome-messages) - Generic Server Protocol Interface (
@fingermarkglobal/protocolsservers)
This allows us to acheive 2 things, Communication Protocol Obfuscation and Interchangeable Communication Mechanisms
Communication Protocol Obfuscation
This allows us to obfuscate the exact protocol that is used when talking to the device and minimize implementation details.
Example:
js
device.connect();
device.write();
device.read();
device.disconnect();vs
js
protocol.send();This also allows us to avoid rewriting client side code when communication protocols need to be extended or modified as the entire process is localized to the library
Interchangeable Communication Mechanisms
This allows us to decouple our application from certain platforms without requiring entire rewrites or platform specific versions of libraries that communicate with devices.
Example:
js
import { chromeAdyen } from '@fingermarkglobal/chrome-adyen';
import { chromeVerifone } from '@fingermarkglobal/chrome-verifone';
import { androidAdyen } from '@fingermarkglobal/android-adyen';
import { androidVerifone } from '@fingermarkglobal/android-verifone';
// chrome
chromeAdyen.send();
chromeVerifone.send();
// android
androidAdyen.send();
androidVerifone.send();vs
js
import { adyen } from '@fingermarkglobal/adyen';
import { verifone } from '@fingermarkglobal/verifone';
import { android } from '@fingermarkglobal/android';
import { chrome } from '@fingermarkglobal/chrome';
// chrome
adyen(chrome).send();
verifone(chrome).send();
// android
adyen(android).send();
verifone(android).send();This allows us to avoid pointless duplication of code in libaries that require device communications.
NOTE this example shows the protocol being passed through as a parameter to the library, but the actual process for overriding communication protocols is still being heavily discussed in this open RFC, mainly the Initialization section.
As mentioned above, we have 2 core libraries that handle the protocol interface and message bus system, @fingermarkglobal/protocols and @fingermarkglobal/chrome-messages
Below is a communication diagram of how this system works specifically in Supersonic (UI to Chrome App):
