TappyBle to PhoneGap communicator bridge
This communicator implementation is creating a bridge between the TappyBLE wrapper and the BLE central plugin.
To get things working in your phonegap / cordova project, you have to follow 4 simple steps:
- Include the BLE central plugin in your project
- Include the following javascript files in your project from the TappyBLE SDK: TappyWrapper, Basic NFC, NDEFJs, TCPM System Family JS and TCPM Tappy
- Include the communicator bridge in your project TappyCommunicator
- Hook up the communicator with the TappyWrapper:
this.communicator = com.kraftbyte.tappy.TappyBleCommunicator.getCurrent();
this.wrapper = new TappyWrapper({ communicator: this.communicator });
To start listening for events, you have to call setupNotifications on the communicator:
this.communicator.setupNotifications();
A sample of a complete setup:
this.wrapper.stop();
window.setTimeout(()=>{
this.communicator.setupNotifications();
window.setTimeout(()=>{
this.wrapper.detectNdef(false, 0);
}, 500);
}, 500);
Now you can use the standard interface of the wrapper described here