Extracting ID from data packet GPS - gps

I am trying to configure a GPS device to my systems. The GPS device send the data packet to my IP in the following format :
$$�W��¬ÿÿÿÿ™U042903.000,A,2839.6408,N,07717.0905,E,0.00,,230111,,,A*7C|1.2|203|0000÷
I am able to extract the latitude, longitude and other information but I am not able to extract the Tracker ID out of the string.
According to the manual the ID is in hex format.And the format of the packet is
$$<L(2 bytes)><ID(7 bytes)><command (2 bytes)><data><checksum (2 bytes)>\r\n
I don't know what to do with it, I have tried converting this to hex..but it didn't work.
Any help will be greatly appreciated.

How about more information? What GPS? What interface (USB, serial)? What language are you working in?
Your data certainly looks odd. In my experience with GPS data, it's generally alphanumeric and separators, but it looks like you have either a corrupt string or non-alphanumeric values.
Update based upon additional information you provided:
The GPRS manual you supplied explains the format:
$$ - 2 bytes - in ASCII code (Hex code: 0x24)
L - 2 bytes - in hex code
ID 7 bytes - in the format of hex code.
For example, if ID is 13612345678, then it will be shown as follows:
0x13, 0x61, 0x23, 0x45, 0x67, 0x8f, 0xff.
command - 2 bytes - hex code
If I understand correctly, the gibberish characters after $$ and before the data field are not printable ASCII characters. They're actual numeric values, provided one byte at a time. If you convert each byte to a hexadecimal-formatted string and display it, you should see what I mean.
I don't remember my PHP well, but I think the ID could be formed into a hexadecimal-formatted string by something like this:
$s = GetYourGPRSStringFromWherever()
$sID = sprintf("0x%02x%02x%02x%02x%02x%02x%02x", $s[4], $s[5], $s[6],
$s[7], $s[8], $s[9], $s[10]);
(also, strip out or ignore any 0xFF values, as per the documentation's example)

Related

While reading data from the uriscan machine, machine is sending first character but could not find out the ascii value of that char

I am work with the serial communication with RS232 standard and trying to getting data from the analyser in this case machine is send data to the host computer but
in the that data machine sent start character '☻' and end character is '♥' but i am not able to find out what type of character these are and how to find the ascii value of these character.
This is data comming from the analyser :
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("☻Date :2017-05-15 13:28:36");
stringBuilder.append("ID_NO:0001-AJAY");
stringBuilder.append("ward - ");
stringBuilder.append("name - ");
stringBuilder.append("BLD - neg");
stringBuilder.append("BIL - neg");
stringBuilder.append("URO +- norm");
stringBuilder.append("KET - neg");
stringBuilder.append("PRO - neg");
stringBuilder.append("NIT - neg");
stringBuilder.append("GLU - neg");
stringBuilder.append("p.H 5.5");
stringBuilder.append("S.G 1.015");
stringBuilder.append("LEU - neg");
stringBuilder.append("COL LT. Yellow");
stringBuilder.append("CLA Clear");
stringBuilder.append("♥");
I want ascii value of these character :
for ex :
Suppose, some machine sent character 0x02 with starting and ending with 0x04 means that starting transmission with 0x02 and ending transmission with 0x04.
There is another thing to set machine configuration parameter like data parity, baud rate manually i would like know how we can set up the parameter of the machine manually.
please help me to solve this scenario Thanks & appreciated advanced...
How specific characters render in your text editor may depend on a number of factors such as the OS, the text editor, whether it is a GUI text editor or a console app (in Windows at least), and whether it is Unicode, or code-page based.
In code page 437 (the original character set for IBM PC/MS-DOS), the ♥ glyph is assigned to ASCII 3 (ETX - End of Text), and ☻ is ASCII 2 (STX - Start of Text), which seems likely in this context.
stringBuilder.append( "\x02" ) ;
stringBuilder.append( "Date :2017-05-15 13:28:36" ) ;
...
stringBuilder.append( "\x03" ) ;
You might have answered your own question by simply inspecting the generated string in your debugger, or by casting the characters to int and outputting them.

GNU Radio text file sink

I'm trying to teach myself basics of GNU Radio and DSP. I created a flowchart in GNU Radio Companion that takes a vector that is the binary representation of a single character (the character "1" as "00110001"), modulates, demodulates, and writes to a file sink.
The scope sink after demodulation looks like the values are returned (see below; appears to be correct pattern of 0s and 1s), but the file sink, although its size is 19 bytes, appears empty, or at least is not returning the correct values (I've looked at it in ASCII and Hex text editors). I assumed the single character transferred would result in 1 byte (or 8 bits) -- not 19 bytes. Changing some of the settings in the Polyphase Sync and adding a Repack Bits block after the binary slicer results in some characters in the output file, but never the right character.
My questions are:
Can GNU Radio take a single character, modulate/demodulate it, and return the same character?
Are there errors in my flowchart?
I'd appreciate any insights or suggestions, thank you.

Hexadecimal numbers vs. hexadecimal enocding (with base64 as well)

Encoding with hexadecimal numbers seems to be different from using hexadecimals to represent numbers. For example, then hex number 0x40 to me should be equal to 64, or BA_{64}, but when I put it through this hex to base64 converter, I get the output: QA== which to me is equal to some number times 64. Why is this?
Also when I check the integer value of the hex string deadbeef I get 3735928559, but when I check it other places I get: 222 173 190 239. Why is this?
Addendum: So I guess it is because it is easier to break the number into bit chunks than treat it as a whole number when encoding? That is pretty confusing to me but I guess I get it.
You may wish to read this:
http://en.wikipedia.org/wiki/Base64
In summary, base64 specifies a specific encoding, which involves using different values for letters than their ASCII encoding.
For the second part, one source is treating the entire string as a 32 bit integer, and the other is dividing it into bytes and giving the value of each byte.

Read input in NASM, and store it whole into a variable

what is the method by which I can read the input of the user, say the input is "500"
then store this number in a variable?
The only method I know would be to store them character by character with possibly the need of register offsets.
Is there any other way, preferably storing the number directly?
i.e. something like:
mov var1, inbuffer
Details on environment:
32 bit Assembly w/ DGJPP
Thank you.
Ahhh... DJGPP, that'd be dos I guess. Look into int 21h/0Ah (0Ah in ah). Or you might be better off with the readfile subfunction (3Fh ???) on stdin. Look it up in Ralf Brown's Interrupt list.
In any case, what you're going to get is the characters '5', '0', and '0' - 35h, 30h, 30h. It will take some processing to get the number 500 out of this. If you're reading numbers from left to right, zero up a register to use as "result so far". Read a character from your input buffer. If it's a valid decimal digit, subtract '0' to convert character to number, multiply "result so far" by ten, and add in your new number. Repeat until you run out of characters.

VBA - Read file byte by byte on system with Asian locale

I am trying to convert a file from binary to text, by simply replacing each character with the hexadecimal code. For example, character 'c' will be replaced by '63'.
I have a code which is working fine in normal systems, but it breaks down in the PC where I need to use it as it has default locale set to Chinese.
I am using the following statements to read a byte -
ch$ = " "
Get #f%, , ch$
I suspect there is a problem when I am reading the file byte by byte, as it is skipping certain bytes because they form composite characters. It's probably reading 2 bytes which form an Asian character as one byte. It is thus forming a much smaller file than the expected size.
How can I read the file byte by byte?
Full code is pasted here: http://pastebin.com/kjpSnqzV
Your suspicion is correct. VB file reading automatically converts strings into Unicode from the default code page on the PC. On an Asian code page, some characters are represented as more than one byte.
I advise you to use a Byte variable rather than a string - that will stop VB being over helpful.
Dim ch As Byte
Get #f%, , ch
Another possible problem with the original code is that some byte sequences are illegal on Asian code pages (they don't represent valid characters). So your code could experience errors for some input files, but presumably you want it to work with any file.