Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi,
i get properties from a remote device (edge) via C-SDK.
There is one property of Type blob (byteArray) which contains multiple (0-32) bytes.
How can i work with blob?
How can i do some bit logic, like check if bit "18" is set?
Checks on the edge Device is not possible because bytes have a different meaning from device to device. Only the Plattform knows how to interpret the bytes
Solved! Go to Solution.
i found a solution for my Problem:
an abstract code to identify single bits:
let length = blob.length;
result = "length: " + length + " | ";
for (var i = 0; i < length; i++) {
result += blob[i].toString(2) + " ";
}
the rest is some string magic
Thank you for reaching out to us. ThingWorx is capable to handle utf-8 encoding.
As per my understanding data you are getting from device is already encrypted in ASC characters right? What kind of data type actually it is ex: string or numeric.
Now once Thingworx receives this data it will show question marks or any other symbol for special characters other than utf-8 format. Please check below article it might helpful to you:
https://www.ptc.com/en/support/article/CS224103
Do let me know for further questions.
Regards,
Mohit
Thanks for the answer but unfortunately this does not answer my problem.
I have attached a screenshot for illustration.
I assign the input parameter of type blob to the variable result. the for loop afterwards does nothing. How can I work with BLOB in Services? How can I process the input?
By the way: the outputstring does not change if I change the blob from "asd" to for example "123".
Not sure if this matches your exact requirement. Check this article: https://www.ptc.com/en/support/article/CS335300
Regards,
Mohit
It is going in the right direction, however the problem is not to package the data in BLOB and send it to the platform.
The problem is I want to process the BLOB data within a TWX service.
i found a solution for my Problem:
an abstract code to identify single bits:
let length = blob.length;
result = "length: " + length + " | ";
for (var i = 0; i < length; i++) {
result += blob[i].toString(2) + " ";
}
the rest is some string magic