Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. //legacy.js
  2. nobleBindings.write = function(peripheralUuid, serviceUuid, characteristicUuid, data, withoutResponse) {
  3. this.sendCBMsg(isLessThan10_8_5 ? 30 : 51, {
  4. kCBMsgArgPeripheralHandle: this._peripherals[peripheralUuid].handle,
  5. kCBMsgArgCharacteristicHandle: this._peripherals[peripheralUuid].services[serviceUuid].characteristics[characteristicUuid].handle,
  6. kCBMsgArgCharacteristicValueHandle: this._peripherals[peripheralUuid].services[serviceUuid].characteristics[characteristicUuid].valueHandle,
  7. kCBMsgArgData: data,
  8. kCBMsgArgType: (withoutResponse ? 1 : 0)
  9. });
  10.  
  11. if (withoutResponse) {
  12. this.emit('write', peripheralUuid, serviceUuid, characteristicUuid);
  13. }
  14. };
  15.  
  16.  
  17. //mavericks.js
  18. nobleBindings.write = function(deviceUuid, serviceUuid, characteristicUuid, data, withoutResponse) {
  19. this.sendCBMsg(65, {
  20. kCBMsgArgDeviceUUID: this._peripherals[deviceUuid].uuid,
  21. kCBMsgArgCharacteristicHandle: this._peripherals[deviceUuid].services[serviceUuid].characteristics[characteristicUuid].handle,
  22. kCBMsgArgCharacteristicValueHandle: this._peripherals[deviceUuid].services[serviceUuid].characteristics[characteristicUuid].valueHandle,
  23. kCBMsgArgData: data,
  24. kCBMsgArgType: (withoutResponse ? 1 : 0)
  25. });
  26.  
  27. if (withoutResponse) {
  28. this.emit('write', deviceUuid, serviceUuid, characteristicUuid);
  29. }
  30. };
  31.  
  32.  
  33. //yosemite.js --> We didn´t do anything here I think...
  34. nobleBindings.write = function(deviceUuid, serviceUuid, characteristicUuid, data, withoutResponse) {
  35. this.sendCBMsg(66, {
  36. kCBMsgArgDeviceUUID: this._peripherals[deviceUuid].uuid,
  37. kCBMsgArgCharacteristicHandle: this._peripherals[deviceUuid].services[serviceUuid].characteristics[characteristicUuid].handle,
  38. kCBMsgArgCharacteristicValueHandle: this._peripherals[deviceUuid].services[serviceUuid].characteristics[characteristicUuid].valueHandle,
  39. kCBMsgArgData: data,
  40. kCBMsgArgType: (withoutResponse ? 1 : 0)
  41. });
  42.  
  43. if (withoutResponse) {
  44. this.emit('write', deviceUuid, serviceUuid, characteristicUuid);
  45. }
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement