Zebra RFID API TagData.getEventTimestamp() returns null from RFD8500 - rfid

I am using the Zebra RFID API 3 SDK 2.0.1.34 to scan RFID tags with the RFD8500 scanner. In my implementation of the eventReadNotify() method from the RfidEventsListener interface, I am extracting the tag ID, RSSI, and timestamp fields. However, the timestamp, which I am trying to get by using the TagData.getTagEventTimeStamp() method, is always null.
for (int i = 0; i < tagArray.getLength(); i++) {
TagData tag = tagArray.getTags()[i];
Log.i("RFID", "Tag ID = " + tag.getTagID());
Log.w ("RFID", "RSSI " + tag.getPeakRSSI());
Log.w("RFID", "timestamp " + tag.getTagEventTimeStamp());
this.dispatchEvent("TagEvent", tag.getTagID());
}
2021-07-20 15:45:16.563 4972-5115/com.radargunn.dev I/RFID: Tag ID = 309406C9D820900000000000
2021-07-20 15:45:16.563 4972-5115/com.radargunn.dev W/RFID: RSSI -51
2021-07-20 15:45:16.563 4972-5115/com.radargunn.dev W/RFID: timestamp null
2021-07-20 15:45:16.563 4972-5115/com.radargunn.dev I/RFID: Tag ID = 30540BDF402E84C000000002
2021-07-20 15:45:16.563 4972-5115/com.radargunn.dev W/RFID: RSSI -62
2021-07-20 15:45:16.564 4972-5115/com.radargunn.dev W/RFID: timestamp null
Is there some configuration setting I need to change to get this to work?

Related

How to set time in Netsuite using suitescript 2.0?

I can set time for timeofday type fields both UI/API.
I can set time for the time type field INITIAL TIME BUDGET as 16:55 using colon(:) separator in UI for Task.
I could not set time for that field as below using suitescript,
function load(recordType, id) {
return record.load({
type: recordType,
id: id
});
}
var recordType = "task"
var id = "123"
var objectRecord = load(recordType, id);
objectRecord.setValue("estimatedtime", "16:55");
var updatedId = objectRecord.save({});
I get this error
You have entered an Invalid Field Value 16:55 for the following field: estimatedtime
I tried the following cases,
"16:55" - Invalid Field Value
16:55 - UNEXPECTED_ERROR
16.55 - No error, but set as "estimatedtime":"16:33"
How to set time for time type field?
You need to create a Date object. For example, say you pass "13:00", you'll need to do something like:
dateStr = "13:00";
d = new Date();
dateParts = dateStr.split(":");
d.setHours(+dateParts[0]);
d.setMinutes(+dateParts[1]);
And then:
objectRecord.setValue("estimatedtime", d);
you have to set only hour value.
Format has to 24 hours.
objectRecord.setValue("estimatedtime", 23);

Access and update the relationship field of a resource

I am grabbing the resource of particular asset from registry by something like this:-
var flight = factory.newResource(Namespace,'Aircraft',flightId);
To this resource, i am assigning a relationship by :-
flight.aircraft = factory.newRelationship('org.acme.airline.aircraft','Aircraft',aircraftId);
flight.aircraft.firstClassSeats = 10;
flight.aircraft.secondClassSeats = 10;
This relationship contains the following properties as defined in model file :
asset Aircraft identified by aircraftId {
o String aircraftId
// Number of seats per class
o Integer firstClassSeats default = 0
o Integer businessClassSeats default = 0
o Integer economyClassSeats default = 0
}
Flight Data :
asset Flight identified by flightId {
o String flightId regex=/[A-Z][A-Z][0-9][0-9][0-9]-[0-9][0-9]-[0-3][0-9]-[0-9][0-9]/
o String flightNumber
o Route route
o String[] aliasFlightNumber optional
--> Aircraft aircraft optional
}
Now, how to update these relationship values (for example firstClassSeats) of a particular flight resource and update it to the corresponding registry.

Query date with offset in AQL

I have this document:
{
paymentDate: '2015-08-08T23:41:23.909Z'
}
my local time is GMT+7 hence the date above is 2015-08-09 6:41:23 in my local time.
I want to send this query below, and receive above document
{
date: '2015-08-09',
offset: '+7'
}
What is the best way to achive that in AQL ?
as can be read in the documentation about dates, ArangoDBs native format JSON doesn't know a special date format, and thus its suggested to store dates as strings.
Best practice is to store UTC in the Database and convert it into the users timezone in the application.
Therefore a query would use FILTER and string comparison to select ranges:
arangosh> db._create("exampleTime");
[ArangoCollection 729616498254, "exampleTime" (type document, status loaded)]
arangosh> var timestamps = ["2014-05-07T14:19:09.522","2014-05-07T21:19:09.522","2014-05-08T04:19:09.522","2014-05-08T11:19:09.522","2014-05-08T18:19:09.522"];
arangosh> for (i = 0; i < 5; i++) db.exampleTime.save({value:i, ts: timestamps[i]})
arangosh> db._query("FOR d IN exampleTime FILTER d.ts > '2014-05-07T14:19:09.522' and d.ts < '2014-05-08T18:19:09.522' RETURN d").toArray()
[
{
"value" : 2,
"ts" : "2014-05-08T04:19:09.522",
"_id" : "exampleTime/729617284686",
"_rev" : "729617284686",
"_key" : "729617284686"
},
{
"value" : 1,
"ts" : "2014-05-07T21:19:09.522",
"_id" : "exampleTime/729617088078",
"_rev" : "729617088078",
"_key" : "729617088078"
},
{
"value" : 3,
"ts" : "2014-05-08T11:19:09.522",
"_id" : "exampleTime/729617481294",
"_rev" : "729617481294",
"_key" : "729617481294"
}
]
If your local time in timezone GMT+7 is 2015-08-09 6:41:23, the JavaScript code new Date().toISOString() would return "2015-08-08T23:41:23.000Z" in that moment. As you can see, it returns UTC time. Your computer needs to have the correct date, time and timezone configured of course.
If you want to query for a date in the past or future, and that date is in local time, you can construct an ISO8601 string with timezone offset specified. Let's say we want to know what 2011-01-01 2:00:00 in GMT+7 is in UTC time:
// timezone offset: 07 hours, 00 minutes (+0700)
new Date("2011-01-01T02:00:00+0700").toISOString()
// result: "2010-12-31T19:00:00.000Z"
The same works in AQL:
RETURN DATE_ISO8601("2011-01-01T02:00:00+0700")
// result: "2010-12-31T19:00:00.000Z"
If you already have a datetime string without timezone offset (2011-01-01T02:00:00), but want to assume it's your local time, you can do the following in JS to append the timezone offset:
// Should return -420 for your timezone GMT+7.
// You can supply an offset in minutes manually as well of course.
var offset = new Date().getTimezoneOffset()
var offsetHours = offset / 60 | 0
var offsetMinutes = Math.abs(offset % 60)
var offsetStr = ((offsetHours < 0) ? "+" : "-") + // GMT + or -?
((Math.abs(offsetHours) < 10) ? "0" : "") + // leading zero for single digit
Math.abs(offsetHours) + // hour portion
((offsetMinutes < 10) ? "0" : "") + // leading zero for single digit
offsetMinutes // minute portion
var dateStr = "2011-01-01T02:00:00" + offsetStr
console.log(dateStr)
console.log(new Date(dateStr).toISOString())
// on a GMT+7 machine, result should be:
// "2011-01-01T02:00:00+0700"
// "2010-12-31T19:00:00.000Z"
If the date string is in local time, but Zulu timezone offset was somehow added, you could correct it by 7 hours like this:
// It should had been +0700 and not +0000
var d = new Date("2015-08-09T06:41:23Z").getTime() - 7 * 60 * 60 * 1000
// result: 1439077283000, which is 2015-08-08T23:41:23.000Z
// or in a really hacky way:
new Date("2015-08-09T06:41:23Z".replace("Z", "+0700"))
//edit
this seems to work too:
var d = new Date("2015-08-09T06:41:23Z")
d.setHours(d.getHours() - 7)
This seems to work reliably even if you cross start or end datetime of DST, at least in Firefox. There was a bug in Chrome however, which led to completely off date calculations: https://code.google.com/p/v8/issues/detail?id=3116

Replace a substring with a project property value in SoapUI groovy script

I need to to replace in a query a parameter with a project property value.
Take this example:
select name from subscribers where phonenb = NEW-CREATE.SUBS.phone and homeaddress = NEW-CREATE.SUBS.address
I should replace everything that starts with the prefix NEW-CREATE.SUBS.
with a project property value whose name comes after this prefix. In my example the project property name would be phone
value 0712345678 could be obtained like this: testRunner.testCase.testSuite.project.getPropertyValue("phone")
and address
value England coming from testRunner.testCase.testSuite.project.getPropertyValue("address")
So after this replace my new query should look like:
select name from subscribers where phonenb = "0712345678" and homeaddress = "England"
And this query I would be able to run on the DBConn, first parameter from the file and then store the result.
Can anyone provide me such a groovy code?
Thanks.
You can use regular expression to identify the property name from the query and then do a replace. The code would look something like this...
def query = "select name from subscribers where phonenb = NEW-CREATE.SUBS.phone and homeaddress = NEW-CREATE.SUBS.address"
def regExp = /NEW-CREATE.SUBS.([a-zA-Z]+)/
matcher = ( query =~ regExp )
matcher.each { match ->
def prop = testRunner.testCase.testSuite.project.getPropertyValue(match[1])
//update the query
query = query.replace("NEW-CREATE.SUBS." + match[1],prop)
}
log.info query
//returns
//Tue Apr 08 11:59:58 ADT 2014:INFO:select name from subscribers where phonenb = 999-999-9999 and homeaddress = nowhere to go
Alternate Solution, Using a prefix stored at project level. The project level property for holding the prefix is called prefix
def query = "select name from subscribers where phonenb = NEW-CREATE.SUBS.phone and homeaddress = NEW-CREATE.SUBS.address"
def prefix = context.expand('${#Project#prefix}') //get prefix from project level properties.
def regExp = /${prefix}([a-zA-Z]+)/
matcher = ( query =~ regExp )
matcher.each { match ->
def prop = testRunner.testCase.testSuite.project.getPropertyValue(match[1])
//update the query
query = query.replace(prefix + match[1],prop)
}
log.info query
//returns
//Tue Apr 08 15:20:51 ADT 2014:INFO:select name from subscribers where phonenb = 999-999-9999 and homeaddress = nowhere to go

How to search Shopify products using title and vendor

I am using the Shopify Storefront search to generate JSON: http://wiki.shopify.com/Storefront_search
Our client has a very large catalogue and we need to be able to search on the product title and product vendor fields but exclude the product body field.
Here is an example of the problem:
Say we have a products called "Galaxy S4" and "Galaxy S3" with vendor "Samsung" and the body text for the S4 starts "Improving on the wildly popular Galaxy S3" we will get the following search results:
myshopify.com/search?q=samsung galaxy s3&type=product&view=json
(searches all product fields for all the words in "samsung galaxy s3")
"Galaxy S3"
"Galaxy S4"
As the phrase "Galaxy S3" appears in the S4 body text it is listed in the search results -not ideal.
myshopify.com/search?q=title:samsung galaxy s3 OR vendor:samsung galaxy s3&type=product&view=json
(searches title field OR vendor field for all the words in "samsung galaxy s3" - this means that unless all of the words appear in either field no results are returned.)
No results
So the outcome we'd like is that is as long as each word in the search term appears in either the title OR the vendor the item is listed.
I hope this makes sense, any suggestions are appreciated.
This is the approach I have taken. I'm using Javascript to take the search query and turn it into a title OR vendor AND title OR vendor string:
var words = search_query.split(" ");
var search_string = '';
var i;
for (i = 0; i < words.length; ++i) {
if(words[i].length>0){
if(i > 0){
search_string += ' AND ';
}
search_string += 'title:'+words[i]+' OR vendor:'+words[i];
}
}
Using the example above this gives the following string:
myshopify.com/search?q=title:samsung OR vendor:samsung AND title:galaxy OR vendor:galaxy AND title:s3 OR vendor:s3&type=product&view=json
Which returns the desired search results.
Note:
Adding an asterisk to each side of the search words will also return partial word matches. i.e.:
search_string += 'title:*'+words[i]+'* OR vendor:*'+words[i]+'*';
Will make "samsun" match "samsung"

Resources