edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale LaBossiere <dml.apa...@gmail.com>
Subject Re: How to send device commands?
Date Tue, 06 Sep 2016 16:02:28 GMT
Yeah, it’s a bit confusing :-)

A description of the IotProvider’s defined device commands (submit/start app, stop application)
can be found in the IotProvider’s **package** javadoc.  The Command Identifier “edgentControl”
is the device command id string.

The IotProvider (services it registers) are layered over the base IotDevice{IotpDevice,MqttDevice}
defined device command mechanism.  The base mechanism doesn’t define commands or involve
mbeans.  Its IotProvider, et al, that does that transparently to the user.  The base IotDevice
mechanism as well as JsonControlService are also available for the user to use for their own
purposes should they desire.

So, the “{COMMAND}” in MqttDevice’s device command topic pattern is where the “edgentControl”
goes. E.g., topic
    “id/012345/cmd/edgentControl/fmt/json”

As described in the IotProvider’s package doc, the edgentControl command’s “stop application”
(sub) command is a JSON payload (for a JsonControlService registered service) like:
    {“type”:”job”,”alias”:”Heartbeat”,”op”:”stateChange”,”args”:[“CLOSE”]}

That payload would be embedded in the general IotDevice.commands() documented device command
JSON:
    {“tsms”:<timestamp>,”command”:”edgentControl”,”format”:”json”,”payload”:<that-payload>}

Hope that helps.

— Dale

> On Sep 5, 2016, at 9:26 AM, Michiel Van Herwegen <michiel@michielvh.be> wrote:
> 
> I'm completely at a loss how sending commands works.
> From the related pieces i discovered in the code and javadoc, i gather that
> the json message needs to adhere to the specifications here:
> https://quarks.incubator.apache.org/javadoc/latest/org/apache/edgent/runtime/jsoncontrol/package-summary.html
> 
> But that does not clear up 2 further elements:
> *First*, what topic to post on. The topic is formatted according to some
> rules as i see it in the MqqtDevice:
> {mqttDevice.topic.prefix}id/{mqttDevice.id}/cmd/{COMMAND}/fmt/json but it's
> unclear to me how to identify the name of the command.
> 
> *Second*, where to get the MBean information from. Here my confusion may
> come from one of the samples:
> https://github.com/apache/incubator-edgent/blob/master/samples/scenarios/src/main/java/org/apache/edgent/samples/scenarios/iotp/IotpFullScenario.java
> It is explicitly stated that this example could be controlled through
> device commands.
> However, there is nowhere an MBean to be found there, nor in the folders
> with the referenced sensors.
> (i am aware that the sample is for iotp - i.e., IBM Watson - and not for
> mqtt, but i'd assume that at least the message content would be similar)
> 
> So completely at a loss here. It would be great if someone could expand a
> bit on the scenario.
> 
> 
> Kind regards,
> Michiel


Mime
View raw message