Skip to content

Commit

Permalink
refactor(client): Remove 'broadcast' from naming of iAm and iHave fun…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
adam-nielsen committed Feb 12, 2019
1 parent eea4572 commit fb082a0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,15 +1133,15 @@ class Client extends EventEmitter {
const buffer = this._getBuffer(receiver && receiver.forwardedFrom);
baNpdu.encode(buffer, baEnum.NpduControlPriority.NORMAL_MESSAGE, receiver);
baApdu.encodeUnconfirmedServiceRequest(buffer, baEnum.PduTypes.UNCONFIRMED_REQUEST, baEnum.UnconfirmedServiceChoice.I_AM);
baServices.iAmBroadcast.encode(buffer, deviceId, this._transport.getMaxPayload(), segmentation, vendorId);
baServices.iAm.encode(buffer, deviceId, this._transport.getMaxPayload(), segmentation, vendorId);
this.sendBvlc(receiver, buffer);
}

iHaveResponse(receiver, deviceId, objectId, objectName) {
const buffer = this._getBuffer(receiver && receiver.forwardedFrom);
baNpdu.encode(buffer, baEnum.NpduControlPriority.NORMAL_MESSAGE, receiver);
baApdu.EecodeUnconfirmedServiceRequest(buffer, baEnum.PduTypes.UNCONFIRMED_REQUEST, baEnum.UnconfirmedServiceChoice.I_HAVE);
baServices.EncodeIhaveBroadcast(buffer, deviceId, objectId, objectName);
baServices.iHave(buffer, deviceId, objectId, objectName);
this.sendBvlc(receiver, buffer);
}

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports.eventInformation = require('./event-information');
module.exports.eventNotifyData = require('./event-notify-data');
module.exports.getEnrollmentSummary = require('./get-enrollment-summary');
module.exports.getEventInformation = require('./get-event-information');
module.exports.iAmBroadcast = require('./i-am-broadcast');
module.exports.iHaveBroadcast = require('./i-have-broadcast');
module.exports.iAm = require('./i-am');
module.exports.iHave = require('./i-have');
module.exports.lifeSafetyOperation = require('./life-safety-operation');
module.exports.privateTransfer = require('./private-transfer');
module.exports.readProperty = require('./read-property');
Expand Down
6 changes: 3 additions & 3 deletions test/unit/service-i-am.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const expect = require('chai').expect;
const utils = require('./utils');
const baServices = require('../../lib/services');

describe('bacstack - Services layer Iam unit', () => {
describe('bacstack - Services layer iAm unit', () => {
it('should successfully encode and decode', () => {
const buffer = utils.getBuffer();
baServices.iAmBroadcast.encode(buffer, 47, 1, 1, 7);
const result = baServices.iAmBroadcast.decode(buffer.buffer, 0);
baServices.iAm.encode(buffer, 47, 1, 1, 7);
const result = baServices.iAm.decode(buffer.buffer, 0);
delete result.len;
expect(result).to.deep.equal({
deviceId: 47,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const expect = require('chai').expect;
const utils = require('./utils');
const baServices = require('../../lib/services');

describe('bacstack - Services layer IhaveBroadcast unit', () => {
describe('bacstack - Services layer iHave unit', () => {
it('should successfully encode and decode', () => {
const buffer = utils.getBuffer();
baServices.iHaveBroadcast.encode(buffer, {type: 8, instance: 443}, {type: 0, instance: 4}, 'LgtCmd01');
const result = baServices.iHaveBroadcast.decode(buffer.buffer, 0, buffer.offset);
baServices.iHave.encode(buffer, {type: 8, instance: 443}, {type: 0, instance: 4}, 'LgtCmd01');
const result = baServices.iHave.decode(buffer.buffer, 0, buffer.offset);
delete result.len;
expect(result).to.deep.equal({
deviceId: {type: 8, instance: 443},
Expand Down

0 comments on commit fb082a0

Please sign in to comment.