In this way I had quick chat session with my manager yesterday. That ended up with challenge#1 (DOORS and IoT) and later on I had another quick chat my friend from DNG team, that ended up with challenge #2 (DOORS 9 itself).
Since challenge #1 is about IoT let's leave details of the other one for another post- but I like the idea so I will definitely post something in that subject.
Challenge #1
It was simply; "DXL triggers and IoT."Well in my last post I used external tool written in NodeJS to publish DOORS 9 TRS feed to IoTF broker.
You need a full DOORS Web Access stack with some extra settings (as TRS is not enabled by default) to be able to get TRS feed which you will consume with your external application before posting that to IoT Foundation broker.
DWA Stack used in last post |
There are no events in TRS so the last example was querying for changes every 10 seconds. That's far from real-time in IoT terms.
DOORS 9 Triggers
Have a look at DXL Reference Manual if you are not familiar with concept of triggers in DOORS 9.Triggers are as close to real-time events as it can be in RM tool. Yeah but DOOR 9 doesn't have MQTT client.
Does it have to have it?
Well NO!
Looking at Internet of Things documentation, you can find topic on HTTP(S) Connectivity for Devices. If you read my previous post you should be familiar with HttpRequest. So your trigger DXL have to do is send a HTTP POST request to
<target server: org_id.internetofthings.ibmcloud.com>/api/v0002/device/types/{DeviceType}/devices/{DeviceID}/events/{eventID}
Looking at the URL format you can guess some event values will be set automatically:
{
"device_type": {DeviceType},
"device_id": {DeviceID},
"evt_type": {eventID},
"timestamp":
{
"$date": 1450194956425
}
So your entire trigger DXL will look like
Module m = current Module Buffer msg = create msg = "" msg += "\"id\": \"" getResourceURL m"\", " msg += "\"content\": \"" name m "\", " msg += "\"group\": \"Open\"" msg += "}" string ioturl = "https://org_id.internetofthings.ibmcloud.com/api/v0002/device/types/DeviceType/devices/DeviceID/events/trigger_update" HttpHeader h = create string auth = "" toBase64_("use-token-auth:YOUR_TOKEN", auth) auth = auth[0:length(auth) -2] add(h, "Authorization", "Basic "auth) add(h, "Content-Type", "application/json") HttpBody b = create setValue(b, msg) HttpResponse resp = HttpRequest(HttpPost, ioturl, b, h) delete b if (!null resp && resp.isOk) { // no one really needs to see it print "got it " (!null resp ? resp.code "" : "null") "\n" delete resp } delete h delete msg
That's all you need to do publish events in real-time to IoTF!
Conclusion
Again HTTP Request proved to be a very powerful and useful perm. Using it the initial stack was reduced to very simple form:Final stack in DOORS to IoTF communication |
DOORS 9 has a potential in it, you just need to know how to use it.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.