GetParameterAttributes/SetParameterAttributes RPCs

James McNab jmcnab at sirran.com
Wed Aug 2 06:13:00 EDT 2017


I’d be interested in contributing to help develop this feature, any guidance would be much appreciated.

In terms of how this might work, this is what I was thinking:

## getParameterAttributes

  # query={
  #    "name": "getParameterAttributes",
  #    "parameterNames":
  #       [
  #          "Device.Time.NTPServer1",
  #          "Device.Time.CurrentLocalTime",
  #          "Device.Time.LocalTimeZone"
  #       ]
  # }

  curl -i 'http://localhost:7557/devices/00236a-96318REF-SR360NA0A4%252D0003196/tasks?timeout=3000&connection_request' \
  -X POST \
  --data '{ "name": "getParameterAttributes", "parameterNames": ["Device.Time.NTPServer1", "Device.Time.CurrentLocalTime", "Device.Time.LocalTimeZone"] }'

## setParameterAttributes

  # query={
  #   "name": "setParameterAttributes",
  #   "parameterAttributes":
  #      [
  #         { 
  #            "name": "Device.Time.NTPServer1", 
  #            "notificationChange": true,
  #            "notification": 2,
  #            "accessListChange": false,
  #            "accessList": "subscriber"
  #          }
  #      ]
  # }

  curl -i 'http://localhost:7557/devices/00236a-96318REF-SR360NA0A4%252D0003196/tasks?connection_request' \
  -X POST \
  --data '{ "name":"setParameterAttributes", "parameterAttributes":[ {"name": "Device.Time.NTPServer1", "notificationChange": true, "notification": 2, accessListChange": false, "accessList": "subscriber"} ] }'

We could then expose the attributes via the JSON structure returned by the API:

  [
      {
          "Device": {
              "Time": {
                  "NTPServer1": {
                      "_object": false,
                      "_timestamp": "2017-08-02T09:53:58.083Z",
                      "_type": "xsd:string",
                      "_value": "0.pool.ntp.org",
                      "_writable": true,
                      "_attributes": {
                        "_notification": 2,
                        "_accessList": "subscriber"
                      }
                  }
              }
          },
          "_id": "000295-0000149898"
      }
  ]

I might be way off base with this; if so let me know if you think it could be done a better way.

> On 2 Aug 2017, at 01:21, Zaid Abdulla <zaid at genieacs.com> wrote:
> 
> On Tue, 2017-07-25 at 16:25 +0100, James McNab wrote:
>> This there any plan to add support for the GetParameterAttributes and
>> SetParameterAttributes RPCs?
> 
> Yes, this is one of the planned features for the next major release. As
> always, contributions are welcome so if you're intrested in
> implementing that feautre yourself let me know and I'd be happy to give
> some guidance.
> 
> -- 
> Zaid Abdulla <zaid at genieacs.com>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users



More information about the Users mailing list