Skip to content

PoweredBySAM/noble-mock-device

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noble mock device

client part of the noble mock.

the server part is is located at: noble-mock

installation

npm run build

usage:

  var device = require('../lib/device.js');
  var deviceData = advertisement: {
      localName: 'MyDeviceName',
      manufacturerData: {
        type: 'Buffer',
        data: [1, 2, 3 ...]
      }
    },
    uuids: {
      charDataRead: "xxx",
      charSetGroupID: "xxx",
      charDataWrite: "xxx",
      pairedFlag: "xxx",
      pairedProfileID: "xxx",
      bdAddress: "xxx",

      serviceBattery: "180f",
      charBatteryLevel: "2a19"
    }

  };

  var pot = device.createDevice("MyNamespace", deviceData); // initialize a device
  pot.connect();                              // connect (get discovered)
  pot.write([42, 42, 42]);                    // send data
  pot.on('write', function(data) {            // receive data
    console.log("data in", data);
  });
  pot.disconnect();                           // close connection

  console.log(pot)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •