Does Leshan support ObjLink? - iot

I am trying to create my composite LWM2M object by using objlink type.
For Leshan, the only source on how to write the spec file in JSON seems to be the official oma-objects-spec.json, which does not contain examples of objlinks.
Can anyone provide an example on how to create an objlink object?
If it is not possible in Leshan, have anyone tried other implementations?

Hope it's not too late.
As of now there is no support of OBJLNK in Leshan API.
I was also needed OBJLNK support in Leshan so i have modified and created a pull request for supporting OBJLNK.
If you want to have objlnk support can use my branch which is forked from Leshan.
https://github.com/DevendraKurre/leshan

Leshan has added support to this feature. I have tested it with version 0.1.11-M14.
Reading can be done as usual, and writing is done as follows.
WriteRequest writeReq = new WriteRequest(
WriteRequest.Mode.UPDATE,
9, 0,
LwM2mSingleResource.newObjectLinkResource(
13,
new ObjectLink(5566, 7788)
)
);

Related

The getEntityAttributes() function in Thingsboard

I am trying to use the attributeService.getEntityAttributes function to obtain some server attributes of my device. I was using the .getEntityAttributesValues function when working with the 2.x version of Thingsboard and it was working fine. With the current version I am using the following code:
var conf = {
ignoreLoading: false,
ignoreErrors: true,
resendRequest: true
};
var myattr = attributeService.getEntityAttributes(entityID,'SERVER_SCOPE',["myattribute"],conf);
But I get no data or error back. I was using the .getEntityAttributesValues with .then() method but it doesn't seem to work anymore. It says ".then is not a function".
What am I doing wrong? Please help and tell me how to use the new function properly. I am using TB v.3.1.1 CE.
Thingsboard 2.x UI was made with AngularJS.
Thingsboard 3.x UI now uses Angular.
One of the key differences between these frameworks in regards of your problem is the move from Promise based services, to Observable based services.
Let's look at the source of the getEntityAttributes function:
https://github.com/thingsboard/thingsboard/blob/2488154d275bd8e6883baabba5519be78d6b088d/ui-ngx/src/app/core/http/attribute.service.ts
It's mostly a thin wrapper around a network call made with the http.get method from Angular.
Therefore, if we have a look at the official documentation: https://angular.io/guide/http#requesting-data-from-a-server, it is mentioned that we must subscribe to the observable in order to handle the response. So something along the lines of:
attributeService.getEntityAttributes(entityID,'SERVER_SCOPE',["myattribute"],conf).subscribe((attributes) => {…})

Base CRM Rails Gem legacy search?

It looks like Base CRM has upgraded their API and replaced all of their endpoints/parameters.
Previously I was able to retrieve "Won" deals using this call:
session = BaseCrm::Session.new("<LEGACY_ACCESS_TOKEN>")
session.deals.all(stage: :won, sort_by: :last_activity, sort_order: :desc, page: 1)
This query recently started ignoring my parameters, yet it continued to respond with unfiltered data (that was fun when I realized that was happening).
The new syntax is:
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
client.deals.where(organization_id: google.id, hot: true)
yet this does not work:
client.deals.where(stage_name: :won)
client.deals.where(stage_name: "Won")
client.deals.where(stage_id: 8) # specified ID found in Base Docs for "Won"
etc.
I've looked into the most recent updates to the Base CRM Gem as well as the Base CRM API Docs but have not found a solution to searching by specific deal stage.
Has anyone had any luck with the new API and this kind of query?
Is there a way to use the legacy API?
I've left message with Base but I really need to fix this, you know, yesterday.
Thanks for your help!
ADDITIONAL INFO
The legacy API/gem responded with JSON where the v2 API/gem responds with a BaseCRM::Deal object:
$ session.deals.find(123456)
# <BaseCRM::Deal
dropbox_email="dropbox#67890.deals.futuresimple.com",
name="Cool Deal Name",
owner_id=54321,
creator_id=65432,
value=2500,
estimated_close_date=nil,
last_activity_at="2016-04-21T02:29:43Z",
tags=[],
stage_id=84588,
contact_id=098765432,
custom_fields={:"Event Location"=>"New York, NY", :Source=>"Friend"},
last_stage_change_at="2016-04-21T02:08:20Z",
last_stage_change_by_id=559951,
created_at="2016-04-18T22:16:35Z",
id=123456,
updated_at="2016-04-21T02:08:20Z",
organization_id=nil,
hot=false,
currency="USD",
source_id=1466480,
loss_reason_id=nil
>
Checkout stage_id. Is this a bug? According to the Docs stage_id should return an integer between 1 and 10.

attachShadow vs createShadowRoot

I read in mozilla doc, Element.createShadowRoot() is deprecated:
This method has been deprecated in favor of attachShadow.
But in my canary: chrome 49.0.2599.0
thats work:
var shadow = document.getElementById("node-sh").createShadowRoot();
And thats not work
var shadow = document.getElementById("node-sh").attachShadow({mode: 'closed'});
Anyone know what's right?
createShadowRoot() is the old way of attaching a shadow-root to host element. It was proposed in initial spec, which has then been deprecated in favor of
attachShadow.
Spec also has been updated.
But, new API hasn't been standardized and none of the browsers currently support it. So I would suggest to stick to createShadowRootfor now. Once you start getting browser warnings for deprecation, that would be the time to move to attachShadow.

.NET SDK for JIRA (Atlassian.SDK) wont allow me to add a custom field even though it exists on JIRA

I am using the latest Atlassian.SDK package for .NET to integrate my application with JIRA
I am trying to create an issue as follows
Jira jiraConn = new Jira("<theurl>", "<theuser>", "<thepasswd>");
Issue objIssue = jiraConn.CreateIssue("EF");
objIssue.Type = "Escalation";
objIssue.Priority = "Major";
objIssue.Summary = "Test with custom fields";
objIssue.CustomFields.Add("Field 1", "Anthony Drive");
objIssue.SaveChanges();
However the line 'objIssue.CustomFields.Add' throws an exception stating 'Could not find custom field with name 'Field 1' on the JIRA server. Make sure this field is available when editing this issue. For more information see JRA-6857'
Is there something that i am missing ?
I am using the SDK ver 2.4.0 and JIRA version 6.3
So there is a bug in the API. When ever a custom field is added , the API fetches a random issue and checks if the field is present in it.
You would need to work with the source code to solve this issue yourself.
I had the same problem. If you use constructor Jira(...) so the API uses SOAP. But when you use Jira.CreateRestClient, client will use REST API. With REST API inserting epics works fine.
Jira jiraConn = Jira.CreateRestClient("<theurl>", "<theuser>", "<thepasswd>");

dbus-glib i can't figure out how to receive a{sv}

i'm using dbus-glib to get the currently playing file name in smplayer2 .
and i got
http://bpaste.net/show/161995/
i trying to use the Get method to get the Metadata(type="a{sv}" )property ,
i write some code like this
DBusGConnection *bus;
GError *error = NULL;
bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
DBusGProxy *smplayer;
smplayer= dbus_g_proxy_new_for_name (bus,
"org.mpris.MediaPlayer2.SMPlayer2",
"/org/mpris/MediaPlayer2",
"org.freedesktop.DBus.Properties");
GValue *Metadata;
dbus_g_proxy_call (smplayer, "Get", &error,
G_TYPE_STRING,"org.mpris.MediaPlayer2.Player",
G_TYPE_STRING,"Metadata", G_TYPE_INVALID,
G_TYPE_VALUE, &Metadata, G_TYPE_INVALID);
but Metadata seen to be empty.
can anyone know this , please ,
any help will appreciate
According to the freedesktop.org DBusBindings page, DBus-GLib is obsolete. Good catch #nemequ
The replacement is GDBus (D-Bus support in GLib) which provides high level and low level API. I would strongly recommend migrating over as the new API provides methods that make working with DBus much easier.
I've only worked with the dbus low level API, not glib but I think g_dbus_gvariant_to_gvalue is what you need. Note that this method is provided in the new API GDBus, not the one that you're using DBus-GLib. The get method returns a variant type, which is a container of sorts. You need to get the value out of the container.
The API Reference is full of good stuff. Check there if the above doesn't do the trick. Hope that helps

Resources