@@ -228,6 +228,36 @@ class Client extends EventEmitter {
228228 result = baServices . decodeDeleteObject ( buffer , offset , length ) ;
229229 if ( ! result ) return debug ( 'Received invalid deleteObject message' ) ;
230230 this . emit ( 'deleteObject' , { address : address , invokeId : invokeId , request : result } ) ;
231+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM ) {
232+ result = baServices . decodeAlarmAcknowledge ( buffer , offset , length ) ;
233+ if ( ! result ) return debug ( 'Received invalid alarmAcknowledge message' ) ;
234+ this . emit ( 'alarmAcknowledge' , { address : address , invokeId : invokeId , request : result } ) ;
235+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_GET_ALARM_SUMMARY ) {
236+ this . emit ( 'getAlarmSummary' , { address : address , invokeId : invokeId } ) ;
237+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_GET_ENROLLMENT_SUMMARY ) {
238+ result = baServices . decodeGetEnrollmentSummary ( buffer , offset , length ) ;
239+ if ( ! result ) return debug ( 'Received invalid getEntrollmentSummary message' ) ;
240+ this . emit ( 'getEntrollmentSummary' , { address : address , invokeId : invokeId , request : result } ) ;
241+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_GET_EVENT_INFORMATION ) {
242+ result = baServices . decodeGetEventInformation ( buffer , offset , length ) ;
243+ if ( ! result ) return debug ( 'Received invalid getEventInformation message' ) ;
244+ this . emit ( 'getEventInformation' , { address : address , invokeId : invokeId , request : result } ) ;
245+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_LIFE_SAFETY_OPERATION ) {
246+ result = baServices . decodeLifeSafetyOperation ( buffer , offset , length ) ;
247+ if ( ! result ) return debug ( 'Received invalid lifeSafetyOperation message' ) ;
248+ this . emit ( 'lifeSafetyOperation' , { address : address , invokeId : invokeId , request : result } ) ;
249+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_ADD_LIST_ELEMENT ) {
250+ result = baServices . decodeAddListElement ( buffer , offset , length ) ;
251+ if ( ! result ) return debug ( 'Received invalid addListElement message' ) ;
252+ this . emit ( 'addListElement' , { address : address , invokeId : invokeId , request : result } ) ;
253+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_REMOVE_LIST_ELEMENT ) {
254+ result = baServices . decodeAddListElement ( buffer , offset , length ) ;
255+ if ( ! result ) return debug ( 'Received invalid removeListElement message' ) ;
256+ this . emit ( 'removeListElement' , { address : address , invokeId : invokeId , request : result } ) ;
257+ } else if ( service === baEnum . ConfirmedServices . SERVICE_CONFIRMED_PRIVATE_TRANSFER ) {
258+ result = baServices . decodePrivateTransfer ( buffer , offset , length ) ;
259+ if ( ! result ) return debug ( 'Received invalid privateTransfer message' ) ;
260+ this . emit ( 'privateTransfer' , { address : address , invokeId : invokeId , request : result } ) ;
231261 } else {
232262 debug ( 'Received unsupported confirmed service request' ) ;
233263 }
@@ -281,6 +311,14 @@ class Client extends EventEmitter {
281311 result = baServices . decodeEventNotifyData ( buffer , offset , length ) ;
282312 if ( ! result ) return debug ( 'Received invalid EventNotify message' ) ;
283313 this . emit ( 'eventNotify' , { address : address , eventData : result . eventData } ) ;
314+ } else if ( service === baEnum . UnconfirmedServices . SERVICE_UNCONFIRMED_I_HAVE ) {
315+ result = baServices . decodeIhaveBroadcast ( buffer , offset , length ) ;
316+ if ( ! result ) return debug ( 'Received invalid ihaveBroadcast message' ) ;
317+ this . emit ( 'ihaveBroadcast' , { address : address , eventData : result . eventData } ) ;
318+ } else if ( service === baEnum . UnconfirmedServices . SERVICE_UNCONFIRMED_PRIVATE_TRANSFER ) {
319+ result = baServices . decodePrivateTransfer ( buffer , offset , length ) ;
320+ if ( ! result ) return debug ( 'Received invalid privateTransfer message' ) ;
321+ this . emit ( 'privateTransfer' , { address : address , eventData : result . eventData } ) ;
284322 } else {
285323 debug ( 'Received unsupported unconfirmed service request' ) ;
286324 }
@@ -962,6 +1000,83 @@ class Client extends EventEmitter {
9621000 } ) ;
9631001 }
9641002
1003+ confirmedPrivateTransfer ( address , vendorId , serviceNumber , data , options , next ) {
1004+ next = next || options ;
1005+ const settings = {
1006+ maxSegments : options . maxSegments || baEnum . MaxSegments . MAX_SEG65 ,
1007+ maxAdpu : options . maxAdpu || baEnum . MaxAdpu . MAX_APDU1476 ,
1008+ invokeId : options . invokeId || this . _getInvokeId ( )
1009+ } ;
1010+ const buffer = this . _getBuffer ( ) ;
1011+ baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE | baEnum . NpduControls . EXPECTING_REPLY , address ) ;
1012+ baAdpu . encodeConfirmedServiceRequest ( buffer , baEnum . PduTypes . PDU_TYPE_CONFIRMED_SERVICE_REQUEST , baEnum . ConfirmedServices . SERVICE_CONFIRMED_PRIVATE_TRANSFER , settings . maxSegments , settings . maxAdpu , settings . invokeId , 0 , 0 ) ;
1013+ baServices . encodePrivateTransfer ( buffer , vendorId , serviceNumber , data ) ;
1014+ baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
1015+ this . _transport . send ( buffer . buffer , buffer . offset , address ) ;
1016+ this . _addCallback ( settings . invokeId , ( err , data ) => {
1017+ if ( err ) return next ( err ) ;
1018+ next ( ) ;
1019+ } ) ;
1020+ }
1021+
1022+ unconfirmedPrivateTransfer ( address , vendorId , serviceNumber , data ) {
1023+ const buffer = this . _getBuffer ( ) ;
1024+ baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE , address ) ;
1025+ baAdpu . encodeUnconfirmedServiceRequest ( buffer , baEnum . PduTypes . PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST , baEnum . UnconfirmedServices . SERVICE_UNCONFIRMED_PRIVATE_TRANSFER ) ;
1026+ baServices . encodePrivateTransfer ( buffer , vendorId , serviceNumber , data ) ;
1027+ baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
1028+ this . _transport . send ( buffer . buffer , buffer . offset , address ) ;
1029+ }
1030+
1031+ getEnrollmentSummary ( address , acknowledgmentFilter , options , next ) {
1032+ next = next || options ;
1033+ const settings = {
1034+ maxSegments : options . maxSegments || baEnum . MaxSegments . MAX_SEG65 ,
1035+ maxAdpu : options . maxAdpu || baEnum . MaxAdpu . MAX_APDU1476 ,
1036+ invokeId : options . invokeId || this . _getInvokeId ( )
1037+ } ;
1038+ const buffer = this . _getBuffer ( ) ;
1039+ baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE | baEnum . NpduControls . EXPECTING_REPLY , address ) ;
1040+ baAdpu . encodeConfirmedServiceRequest ( buffer , baEnum . PduTypes . PDU_TYPE_CONFIRMED_SERVICE_REQUEST , baEnum . ConfirmedServices . SERVICE_CONFIRMED_GET_ENROLLMENT_SUMMARY , settings . maxSegments , settings . maxAdpu , settings . invokeId , 0 , 0 ) ;
1041+ baServices . encodeGetEnrollmentSummary ( buffer , acknowledgmentFilter , options . enrollmentFilter , options . eventStateFilter , options . eventTypeFilter , options . priorityFilter , options . notificationClassFilter ) ;
1042+ baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
1043+ this . _transport . send ( buffer . buffer , buffer . offset , address ) ;
1044+ this . _addCallback ( settings . invokeId , ( err , data ) => {
1045+ if ( err ) return next ( err ) ;
1046+ const result = baServices . decodeGetEnrollmentSummaryAcknowledge ( data . buffer , data . offset , data . length ) ;
1047+ if ( ! result ) return next ( new Error ( 'INVALID_DECODING' ) ) ;
1048+ next ( null , result ) ;
1049+ } ) ;
1050+ }
1051+
1052+ unconfirmedEventNotification ( address , eventNotification ) {
1053+ const buffer = this . _getBuffer ( ) ;
1054+ baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE , address ) ;
1055+ baAdpu . encodeUnconfirmedServiceRequest ( buffer , baEnum . PduTypes . PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST , baEnum . UnconfirmedServices . SERVICE_UNCONFIRMED_EVENT_NOTIFICATION ) ;
1056+ baServices . encodeEventNotifyData ( buffer , eventNotification ) ;
1057+ baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
1058+ this . _transport . send ( buffer . buffer , buffer . offset , address ) ;
1059+ }
1060+
1061+ confirmedEventNotification ( address , eventNotification , options , next ) {
1062+ next = next || options ;
1063+ const settings = {
1064+ maxSegments : options . maxSegments || baEnum . MaxSegments . MAX_SEG65 ,
1065+ maxAdpu : options . maxAdpu || baEnum . MaxAdpu . MAX_APDU1476 ,
1066+ invokeId : options . invokeId || this . _getInvokeId ( )
1067+ } ;
1068+ const buffer = this . _getBuffer ( ) ;
1069+ baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE | baEnum . NpduControls . EXPECTING_REPLY , address ) ;
1070+ baAdpu . encodeConfirmedServiceRequest ( buffer , baEnum . PduTypes . PDU_TYPE_CONFIRMED_SERVICE_REQUEST , baEnum . ConfirmedServices . SERVICE_CONFIRMED_EVENT_NOTIFICATION , settings . maxSegments , settings . maxAdpu , settings . invokeId , 0 , 0 ) ;
1071+ baServices . encodeEventNotifyData ( buffer , eventNotification ) ;
1072+ baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
1073+ this . _transport . send ( buffer . buffer , buffer . offset , address ) ;
1074+ this . _addCallback ( settings . invokeId , ( err , data ) => {
1075+ if ( err ) return next ( err ) ;
1076+ next ( ) ;
1077+ } ) ;
1078+ }
1079+
9651080 // Public Device Functions
9661081 readPropertyResponse ( receiver , invokeId , objectId , property , value ) {
9671082 const buffer = this . _getBuffer ( ) ;
0 commit comments