Tunneled Btle Accessory Service
UUID: 00000056-0000-1000-8000-0026BB765291
Required Characteristics
Example
The example below is automatically generated and may not be a complete example of what is required to create a working "Tunneled Btle Accessory Service" Homebridge plugin. Note
// Example Tunneled Btle Accessory Service Plugin module.exports = (api) => { api.registerAccessory('ExampleTunneledBTLEAccessoryServicePlugin', ExampleTunneledBTLEAccessoryServiceAccessory); }; class ExampleTunneledBTLEAccessoryServiceAccessory { constructor(log, config, api) { this.log = log; this.config = config; this.api = api; this.Service = this.api.hap.Service; this.Characteristic = this.api.hap.Characteristic; // extract name from config this.name = config.name; // create a new Tunneled Btle Accessory Service service this.service = new this.Service(this.Service.TunneledBTLEAccessoryService); // create handlers for required characteristics this.service.getCharacteristic(this.Characteristic.Name) .on('get', this.handleNameGet.bind(this)); this.service.getCharacteristic(this.Characteristic.AccessoryIdentifier) .on('get', this.handleAccessoryIdentifierGet.bind(this)); this.service.getCharacteristic(this.Characteristic.TunneledAccessoryStateNumber) .on('get', this.handleTunneledAccessoryStateNumberGet.bind(this)); this.service.getCharacteristic(this.Characteristic.TunneledAccessoryConnected) .on('get', this.handleTunneledAccessoryConnectedGet.bind(this)) .on('set', this.handleTunneledAccessoryConnectedSet.bind(this)); this.service.getCharacteristic(this.Characteristic.TunneledAccessoryAdvertising) .on('get', this.handleTunneledAccessoryAdvertisingGet.bind(this)) .on('set', this.handleTunneledAccessoryAdvertisingSet.bind(this)); this.service.getCharacteristic(this.Characteristic.TunnelConnectionTimeout) .on('get', this.handleTunnelConnectionTimeoutGet.bind(this)) .on('set', this.handleTunnelConnectionTimeoutSet.bind(this)); } /** * Handle requests to get the current value of the "Name" characteristic */ handleNameGet(callback) { this.log.debug('Triggered GET Name'); // set this to a valid value for Name const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Accessory Identifier" characteristic */ handleAccessoryIdentifierGet(callback) { this.log.debug('Triggered GET AccessoryIdentifier'); // set this to a valid value for AccessoryIdentifier const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Tunneled Accessory State Number" characteristic */ handleTunneledAccessoryStateNumberGet(callback) { this.log.debug('Triggered GET TunneledAccessoryStateNumber'); // set this to a valid value for TunneledAccessoryStateNumber const currentValue = 1; callback(null, currentValue); } /** * Handle requests to get the current value of the "Tunneled Accessory Connected" characteristic */ handleTunneledAccessoryConnectedGet(callback) { this.log.debug('Triggered GET TunneledAccessoryConnected'); // set this to a valid value for TunneledAccessoryConnected const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "Tunneled Accessory Connected" characteristic */ handleTunneledAccessoryConnectedSet(value, callback) { this.log.debug('Triggered SET TunneledAccessoryConnected:' value); callback(null); } /** * Handle requests to get the current value of the "Tunneled Accessory Advertising" characteristic */ handleTunneledAccessoryAdvertisingGet(callback) { this.log.debug('Triggered GET TunneledAccessoryAdvertising'); // set this to a valid value for TunneledAccessoryAdvertising const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "Tunneled Accessory Advertising" characteristic */ handleTunneledAccessoryAdvertisingSet(value, callback) { this.log.debug('Triggered SET TunneledAccessoryAdvertising:' value); callback(null); } /** * Handle requests to get the current value of the "Tunnel Connection Timeout " characteristic */ handleTunnelConnectionTimeoutGet(callback) { this.log.debug('Triggered GET TunnelConnectionTimeout'); // set this to a valid value for TunnelConnectionTimeout const currentValue = 1; callback(null, currentValue); } /** * Handle requests to set the "Tunnel Connection Timeout " characteristic */ handleTunnelConnectionTimeoutSet(value, callback) { this.log.debug('Triggered SET TunnelConnectionTimeout:' value); callback(null); } }