@@ -449,8 +449,9 @@ module.exports = function(options) {
449449 * The readProperty command reads a single property of an object from a device.
450450 * @function bacstack.readProperty
451451 * @param {string } address - IP address of the target device.
452- * @param {number } objectType - The BACNET object type to read.
453- * @param {number } objectInstance - The BACNET object instance to read.
452+ * @param {object } objectId - The BACNET object ID to read.
453+ * @param {number } objectId.type - The BACNET object type to read.
454+ * @param {number } objectId.instance - The BACNET object instance to read.
454455 * @param {number } propertyId - The BACNET property id in the specified object to read.
455456 * @param {object= } options
456457 * @param {MaxSegments= } options.maxSegments - The maximimal allowed number of segments.
@@ -462,11 +463,11 @@ module.exports = function(options) {
462463 * var bacnet = require('bacstack');
463464 * var client = new bacnet();
464465 *
465- * client.readProperty('192.168.1.43', 8, 44301, 28, function(err, value) {
466+ * client.readProperty('192.168.1.43', {type: 8, instance: 44301} , 28, function(err, value) {
466467 * console.log('value: ', value);
467468 * });
468469 */
469- self . readProperty = function ( address , objectType , objectInstance , propertyId , options , next ) {
470+ self . readProperty = function ( address , objectId , propertyId , options , next ) {
470471 next = next || options ;
471472 var settings = {
472473 maxSegments : options . maxSegments || baEnum . MaxSegments . MAX_SEG65 ,
@@ -478,7 +479,7 @@ module.exports = function(options) {
478479 baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE | baEnum . NpduControls . EXPECTING_REPLY , address , null , DEFAULT_HOP_COUNT , baEnum . NetworkMessageTypes . NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK , 0 ) ;
479480 var type = baEnum . PduTypes . PDU_TYPE_CONFIRMED_SERVICE_REQUEST | ( settings . maxSegments !== baEnum . MaxSegments . MAX_SEG0 ? baEnum . PduTypes . SEGMENTED_RESPONSE_ACCEPTED : 0 ) ;
480481 baAdpu . encodeConfirmedServiceRequest ( buffer , type , baEnum . ConfirmedServices . SERVICE_CONFIRMED_READ_PROPERTY , settings . maxSegments , settings . maxAdpu , settings . invokeId , 0 , 0 ) ;
481- baServices . encodeReadProperty ( buffer , objectType , objectInstance , propertyId , settings . arrayIndex ) ;
482+ baServices . encodeReadProperty ( buffer , objectId . type , objectId . instance , propertyId , settings . arrayIndex ) ;
482483 baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
483484 transport . send ( buffer . buffer , buffer . offset , address ) ;
484485 addCallback ( settings . invokeId , function ( err , data ) {
@@ -493,10 +494,10 @@ module.exports = function(options) {
493494 * The writeProperty command writes a single property of an object to a device.
494495 * @function bacstack.writeProperty
495496 * @param {string } address - IP address of the target device.
496- * @param {number } objectType - The BACNET object type to write.
497- * @param {number } objectInstance - The BACNET object instance to write.
497+ * @param {object } objectId - The BACNET object ID to write.
498+ * @param {number } objectId.type - The BACNET object type to write.
499+ * @param {number } objectId.instance - The BACNET object instance to write.
498500 * @param {number } propertyId - The BACNET property id in the specified object to write.
499- * @param {number } priority - The priority to be used for writing to the property.
500501 * @param {object[] } values - A list of values to be written to the specified property.
501502 * @param {ApplicationTags } values.tag - The data-type of the value to be written.
502503 * @param {number } values.value - The actual value to be written.
@@ -511,13 +512,13 @@ module.exports = function(options) {
511512 * var bacnet = require('bacstack');
512513 * var client = new bacnet();
513514 *
514- * client.writeProperty('192.168.1.43', 8, 44301, 28, 12 , [
515+ * client.writeProperty('192.168.1.43', {type: 8, instance: 44301} , 28, [
515516 * {type: bacnet.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: 100}
516517 * ], function(err, value) {
517518 * console.log('value: ', value);
518519 * });
519520 */
520- self . writeProperty = function ( address , objectType , objectInstance , propertyId , values , options , next ) {
521+ self . writeProperty = function ( address , objectId , propertyId , values , options , next ) {
521522 next = next || options ;
522523 var settings = {
523524 maxSegments : options . maxSegments || baEnum . MaxSegments . MAX_SEG65 ,
@@ -529,7 +530,7 @@ module.exports = function(options) {
529530 var buffer = getBuffer ( ) ;
530531 baNpdu . encode ( buffer , baEnum . NpduControls . PRIORITY_NORMAL_MESSAGE | baEnum . NpduControls . EXPECTING_REPLY , address , null , DEFAULT_HOP_COUNT , baEnum . NetworkMessageTypes . NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK , 0 ) ;
531532 baAdpu . encodeConfirmedServiceRequest ( buffer , baEnum . PduTypes . PDU_TYPE_CONFIRMED_SERVICE_REQUEST , baEnum . ConfirmedServices . SERVICE_CONFIRMED_WRITE_PROPERTY , settings . maxSegments , settings . maxAdpu , settings . invokeId , 0 , 0 ) ;
532- baServices . encodeWriteProperty ( buffer , objectType , objectInstance , propertyId , settings . arrayIndex , settings . priority , values ) ;
533+ baServices . encodeWriteProperty ( buffer , objectId . type , objectId . instance , propertyId , settings . arrayIndex , settings . priority , values ) ;
533534 baBvlc . encode ( buffer . buffer , baEnum . BvlcFunctions . BVLC_ORIGINAL_UNICAST_NPDU , buffer . offset ) ;
534535 transport . send ( buffer . buffer , buffer . offset , address ) ;
535536 addCallback ( settings . invokeId , function ( err , data ) {
0 commit comments