ws-slave.js
function readRaw(peripheralId, serviceUuid, uuid, callback){
  //todo catch exceptions
  var handle = servicesCache[peripheralId].services[serviceUuid].characteristics[uuid].handle;
  var peripheral = peripherals[peripheralId];

  //if not connected, connect
  checkConnected(peripheral, function(){
    peripheral.readHandle(handle, function(error, data){
      if (error) {
        debug('readHandle error : '.red + error)
      }
      debug('read handle data :' + data.toString('hex'));

      sendEvent({
          type: 'read',
          peripheralId: peripheralId,
          serviceUuid: serviceUuid,
          characteristicUuid: uuid,
          data: data.toString('hex'),
          isNotification: false
      });

      if (callback) { callback(error, data); }
    });
  })
}
function readRaw(peripheralId, serviceUuid, uuid, callback){
  //todo catch exceptions
  var handle = servicesCache[peripheralId].services[serviceUuid].characteristics[uuid].handle;
  var peripheral = peripherals[peripheralId];

  //if not connected, connect
  checkConnected(peripheral, function(){
    peripheral.readHandle(handle, function(error, data){
      if (error) {
        debug('readHandle error : '.red + error)
      }
      debug('read handle data :' + data.toString('hex'));

      sendEvent({
          type: 'read',
          peripheralId: peripheralId,
          serviceUuid: serviceUuid,
          characteristicUuid: uuid,
          data: data.toString('hex'),
          isNotification: false
      });

      if (callback) { callback(error, data); }
    });
  })
}
function readRaw ( peripheralId , serviceUuid , uuid , callback ) { //todo catch exceptions var handle = servicesCache [ peripheralId ] . services [ serviceUuid ] . characteristics [ uuid ] . handle ; var peripheral = peripherals [ peripheralId ] ; //if not connected, connect checkConnected ( peripheral , function ( ) { peripheral . readHandle ( handle , function ( error , data ) { if ( error ) { debug ( 'readHandle error : ' . red + error ) } debug ( 'read handle data :' + data . toString ( 'hex' ) ) ; sendEvent ( { type : 'read' , peripheralId : peripheralId , serviceUuid : serviceUuid , characteristicUuid : uuid , data : data . toString ( 'hex' ) , isNotification : false } ) ; if ( callback ) { callback ( error , data ) ; } } ) ; } ) }
read by handle
read by handle