gpsd parsing GPRMC data incorrectly - bluetooth

I've connected my Nokia N9 to my linux laptop via bluetooth-serial using the extGPS app from Ovi. Everything seems to work fine im able to connect gpsd to the serial device and get GPS output.
But theres a problem with the GPS output, the longitude is always 0.000E when, in my case the correct GPS longitude should be something like -9.13245
gpsd:IO: <= GPS: $GPRMC,184922.0,A,3842.126000,N,0-9-26.781000,E,000.10.0,131.15,211013,,,A*49
gpsd:IO: => client(0): {"class":"TPV","tag":"RMC","device":"/devrfcomm0","mode":3,"time":"2013-10-21T18:50:48.000Z","ept":0.005,"lat":38.702000000,"lon":0.000000000,"alt":74.000,"track":126.0800,"speed":0.000,"climb":0.000}\x0d\x0a
The problem might be with gpsd parsing the GPRMC data.
Is there a way to solve this or an alternitive to gpsd in linux ?

The fault is not the gpsd.
Look at the RMC sentence.
"$GPRMC,184922.0,A,3842.126000,N,0-9-26.781000,E,000.10.0,131.15,211013,,,A*49"
This is garbage! especially: 0-9-26.781000
What is that? This is not a coordinate, and for sure not in the format as specified in the RMC sentence.

Related

^HV Only returning some values

I'm trying to print some RFID tags and retrieve their TIDs to store them in my system and know which tags have been printed. Right now I'm reading the TID and sending it back to my computer (connected via USB with the my ZT421 printer) with the following code:
^RFR,H,0,12,2^FN0^FS^FH_^HV0,24,,_0D_0A,L^FS
^RFW,H,2,12,1^FD17171999ABABABAAAAAAAAAB^FS
This is repeated for each tag that I'm printing. However, when printing 10 tags, I only get 9 TIDs. If after that I try to print 7 tags, I still get 9 TIDs. To be honest I'm a bit lost now, because even trying to use the code examples from the ZPL manual (I've tried the ^RI instruction also) it doesn't seem to work.
The communication with the printer is beeing done through Zebra Setup Utilities' direct communication tool.
I tried to retrieve each printed tag TID with:
^RFR,H,0,12,2^FN0^FS^FH_^HV0,24,,_0D_0A,L^FS
^RFW,H,2,12,1^FD17171999ABABABAAAAAAAAAB^FS
but I always get 9 TIDs.
I also tried getting the TID with the ZPL manual example for the ^RI command:
^XA
^FO20,120^A0N,60^FN0^FS
^RI0,,5^FS
^HV0,,Tag ID:^FS
^XZ
And I got absolutely nothing returned to the computer, just a mssage saying "Tag ID:" and no value shown.
I would really appreciate some help with this...
Thanks in advance!
I've fixed the issue, but I'm going to leave the solution here just in case someone else is facing the same problem.
I thought that maybe it wasn't a code issue, but something related to the computer-printer communication. It turned out to be the case. The Zebra Setup Utilities program has a button that says "options". If you click it, a new screen will open and there you can configure the seconds that the program will wait for the printer response (in this case through USB). By default it's set to 5, i changed this value to 100, which is the maximum. This meant that instead of just printing and retrieving the TIDs of 6-9 tags, now I can do it for about 100.
This is not amazing because in my case it implied creating 25 files for the 2500 tags I had to print and store the TIDs, however it's far better than before.

Using Findstr to find a serial number in a line

I am using devcon to query a verifone device to get the serial number and I a trying to find the serial number below "123-552-666" and output that to a text file. I have been playing around with various commands but just cant seem to get it.
I have used this:
findstr /RC:"[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9]" "verifone1.txt"
But just got this lie returned
USB\VID_11CA&PID_0300\123-552-666_____
Below is the full data I am searching. Would appreciate any assistance
USB\VID_11CA&PID_0300\123-552-666_____
Name: Verifone V,P Family USB UART device (COM7)
Driver is running.

How to identify identical USB dongles connected at the same time to an USBhub

I have an USBhub (D-Link DUB-H7) connected to my laptop with Windows 10. Connected to the hub are 4 identical PEAK dongles to talk to a CANbus. Now, my problem is to programmatically identify these 4 seperate dongles and knowing which one is which. The dongles are fixed in the hub.
To start I downloaded and installed USBDeview to view my devices. In the program I can see my 4 PCAN-USB dongles and I can see that their Instance ID are different. That's good, now I have my identifier. However, once I try to get the ID's with Python things aren't looking good. This is my following test program:
import win32com.client
wmi = win32com.client.GetObject("winmgmts:")
input("Connect the hub")
dongle_list = [(usb.name, usb.DeviceID) for usb in wmi.InstancesOf("Win32_USBHub")]
input("Disconnect the hub")
nod_list = [(usb.name, usb.DeviceID) for usb in wmi.InstancesOf("Win32_USBHub")]
diff = list(set(dongle_list) - set(nod_list))
for d in diff:
print(d)
Running this gives me only 2 new usb devices and the ID's point to the USBhub rather than the dongles connected to the hub. I also tried with wmi.InstancesOf("CIM_USBDevice") but the result stays the same.
('Generic USB Hub', 'USB\\VID_05E3&PID_0608\\5&4A43CD6&0&4')
('Generic USB Hub', 'USB\\VID_05E3&PID_0608\\6&9EBFB9C&0&4')
So how can I retrieve the usb information of the devices connected to the USBhub using Python or powershell/cmd invoked by Python?
Another route I was thinking I could take is by using port identifiers. If I disconnect a dongle I can see that it was connected to Port_#0001.Hub_#000x, where is x is a positive integer. So maybe I could poll the port to see if the dongle is connected and then I too know which one is which (dongles are fixed in the hub). Although I think that using the Instance ID is more foolproof.
I ended up creating a powershell command and invoke that using Python. I noticed however that the InstanceID's are hardware addresses of the the USBhub and not the dongles.
I also noticed that the dongles sometimes switch their addresses related on how they were connected. So I also needed to disable them and enable them again in the order I want.
This is what I have now:
poll_cmd = """
$ret = (Get-PnpDevice | ? {($_.description -like "*pcan*") -and ($_.status -eq "ok")} | sort instanceid).instanceid;
$ret | % {Disable-PnpDevice $_ -Confirm:$False};
$ret | % {Start-Sleep -Seconds 1; Enable-PnpDevice $_ -Confirm:$False};
$ret
"""
usbs = (
subprocess.check_output(["powershell.exe", poll_cmd])
.decode()
.strip()
.split("\r\n")
)
usbs holds the list of usb dongles I'm interested in.
However this gave me one more problem: UAC. I need admin rights to enable the usbs. And used the top answer from Request UAC elevation from within a Python script? to give my program admin rights.

List attributes on an Allen-Bradley sensor gateway

I'm want to read sensor data from an A-B 1734-AENTR device using EtherNet/IP. As a proof of concept, I'm trying to use cpppo to read values. The object addresses are in the form of #1/1/1, so I'm getting data with commands like:
python -m cpppo.server.enip.get_attribute -a 192.168.1.2 --print '#1/1/1'
Can I view sensor data like this?
How can I find out the CIP object addresses of the sensors?
Do I need to specify a route?
Is there a better utility for doing this?

Getting Device IMEI

How to get the IMEI of a Java ME device in a common way that is applicable to all devices
Usually, using java.lang.System.getProperty() can return the device IMEI.
Unfortunately, the String parameter you need to use to get the IMEI will change from one handset manufacturer to the next.
Strings to try:
imei
phone.imei
com.lge.imei
com.nokia.imei
com.nokia.mid.imei
com.siemens.imei
com.sonyericsson.imei
com.motorola.imei
...
you get the idea.
you may need to uppercase the last part of the string.
the format of the result can change too.
it can be a full imei with a "IMEI" prefix and 3 "-" in the middle of 17 digits.
it can be a normalized imei of 13 or 15 digits...
there is no standard way to get the IMEI via Java ME. some phones expose the IMEI as a system property, but others don't or require the midlet to be signed to operator or manufacturer domain (ie. not by you).
In the game i'm developing, to get an unique id for every cellphone (so that they can't duplicate and share savefiles) i use the bluetooth mac address that is different for every single bluetooth device and the java code to get it is the same on every device =D
I have tried what is suggested by both ax and quickrecipeonsymbianos however they both solve the purpose in an elegant way. However, in the BlackBerry we have the getDeviceID() to get the unique id of the device, but Java ME lacks this functionality

Resources