Parse Binary Data Received Through Bluetooth
Sep 22, 2011
I have an application that receives data in binary form through bluetooth. I read the data using bluetoothsocket to an byte[]. But i must parse all messages, because they must have an given format and they are in binary.
My solution was to convert byte[] to a string and then split the string and parse all received messages.
An example of the data to parse:
0000000010000001
I should know that the first 8 zeros are the header and 10000001 the real data.
My idea was to create a string that represents -> 0000000010000001 and then split the whole string in one byte and check the value, like:
string1 had 00000000
string2 had 10000001
I know that 8 zeros are the header, therefore string2 has the representation of the data.
View 1 Replies
May 15, 2014
I primarily do hardware and firmware design, but a new product my company is developing has the need for an Android app and since I have the most Android programming experience (which is extremely limited) that leaves the task to me. I need a little guidance figuring out how to do a few things so that I can get this app up and running. I already have a simple GUI to display some stuff, but what I need is a way to handle data.
I am trying to receive a 148 byte stream of data over a serial connection, parse it into a structure and display certain values from that structure. The data is packed in a struct that is sent from a micro controller and due to that it has a very specific layout (i.e. the first 8 bytes mean this, the next 16 bytes are this... ). In C, I can just declare a struct with those values and use the #pragma pack function to eliminate any extra spacing the compiler would otherwise inject for alignment purposes, receive the data and do a memcpy into the struct to write the data. It's not the safest or cleanest way to do it, but it takes very little time and if you do CRC tests to make sure the data received is valid it works like a charm.
Now to the root of the problem: How do I declare structs in Java? Is there a way to pack them tightly like you can using C? Once I've received the binary data, is there a way to parse it into the structure easily? These are the issues we hardware programmers face when dealing with Java...
View 2 Replies
View Related
Nov 2, 2010
I have some binary data (pixel values) in a int[] (or a byte[] if you prefer) that I want to write to disk in an Android app. I only want to use a small amount of processing time but want as much compression as I can for this. What are my options?In many cases the array will contain lots of consecutive zeros so something simple and fast like RLE compression would probably work well. I can't see any Android API functions for this though. If I have to loop over the array in Java, this will be very slow as there is no JIT on most Android devices. I could use the NDK but I'd rather avoid this if I can.
View 4 Replies
View Related
Jun 15, 2010
Android supports a limited version of apache's http client(v4). typically if I want to send binary data using content type= application/octet-stream via POST,
I do the following:
CODE:.........................
However ByteArrayRequestEntity is not supported on android. what can I do?
View 1 Replies
View Related
Jul 8, 2010
I'm looking for some input on how to go about a problem I have. We have a device that has binary data that it needs to send out (they are mainly just symbols, but in a custom binary format) over ethernet. I need to intercept this data on the phone and display the symbols over google maps. I'm just wondering the best way to go about this, I have a few ideas but am not sure if they are possible or feasable: 1. Is it possible for the phone to connect directly to the device if the device had some sort of server running on it, then poll for new data? If so, what is the protocol needed to be able to direct connect like that? 2. Perhaps modify the device software to send data to the phone(s) in SMS data message format? Im not sure if it is possible for software to "spoof" an SMS to a phone when it is not a phone itself? 3. Have the device software upload all its binary data to a ftp/http server that is sitting out there somewhere, have the phone(s) connect to that server and poll for new data periodically? I'm brand new to android development, basically all I want to do is grab this binary data from the device on my phone and parse/display it over google maps. How do any of those ideas sound, or is there a much easier way I am overlooking?
View 2 Replies
View Related
Oct 6, 2010
I have created an android app. It sends a data message on a port for communicating with the same app on some other phone. While sending the message, i have encoded it into binary data using ISO8859_1 encoding.
byte[] b1=payload.getbytes();
I am able to receive the data message at the receiving end. But the problem is that after receving it in binary format , My app needs to decode the message back to string or human read-able format. But i am not able to do the same.
I have tried to convert it into String using 'toString()' but string contains binary character .
View 1 Replies
View Related
Sep 8, 2010
My app will have an SQLite database with some embedded JPEG images -- basically the binary contents of a JPEG file stored as a Blob in the database. Can someone point me in the general direction of where to start to figure out how to convert this "array of bytes" into a Bitmap object that can be further manipulated and displayed in an ImageView?
View 2 Replies
View Related
Sep 26, 2010
How to parse xml data.. file is php file and Soap is used in xml..
i am going to use this in a android application.
please provide me proper codes
View 1 Replies
View Related
Feb 28, 2012
I want to create an app that displays flight information such as: arrival/departure info, canceled flights, etc. I don't know how to query the data from the website in order to display it in the app.
View 4 Replies
View Related
Oct 29, 2010
i need to parse this response in android using the android json parser but the thing i cant find the answer to anywhere is: how do i parse the data if for example "itineraries" can contain one or sometimes more objects of the type itinerary? if it contains one than it is returned like this but if it contains more it is returned with [] with this example "itinerary" cannot be placed into a JsonArray becouse obviously it is not an array. (not placed in [] right?)
how do i parse this? any examples?
{
"plan":{
"date":"2010-10-20T00:00:00+02:00",
"from":{
"name":"Булевар Партизански Одреди",................
View 1 Replies
View Related
Oct 4, 2010
I have a web service, .asmx that when consumed gives a response in the form:
<lData>
<name>...</name>
<posx>..</posx>
<posy>...</posy>
</lData>
I use Ksoap2 to consume the web service in Android, and I see the response as a string anyType {lData=anyType{name=....;posx=....;posy=....;};}
So, I get the right data from my web service, but i don't know how to parse it correctly.
I want to find a way to iterate through the different nodes.
I have tried to use a SAXParser, but can't seem to understand what I should use instead of the url. In the tutotirals I have followed the link to a xml-file on a url, but my url is only part "finished" since i need to consume the web service first. code...
Is this above something I should use, but have another openStream?
View 1 Replies
View Related
Aug 31, 2010
I have an Android application which handles a particular type of file. It registers intent filters for both the MIME type and the filename pattern. This all works fine from file managers; I select a file, I get prompted with a list of actions applicable to the file, my application is on the list, I select it and it works.
However, this doesn't work when I beam a file to the device via Bluetooth. The file gets received and is correctly downloaded, but selecting the file from the transfer page does nothing (although I can still use a file manager to find the downloaded file in /sdcard/downloads/bluetooth and run it from there).
The log contains:
CODE:.......
(The name of the file here is foo.app.)
It looks like it's deciding that the file has no MIME type and is giving up, rather than broadcasting an intent asking for a filename-based match.
This is on Froyo on an HTC Desire, and I know that HTC have been tinkering with the Bluetooth stack (as stock Android doesn't allow arbitrary files to be beamed to the device). Does anyone know how I can make this work? Beaming .jpg and .png files works fine...
View 1 Replies
View Related
Sep 24, 2010
I've only had my phone a couple of weeks and pleased with it now that I have installed many of the recommended free apps.
I have one problem though with the bluetooth. When I connect to my car bluetooth, everything is fine for 8 minnutes - calls can be made and received but then the bluetooth drops. As this happens when I am driving the easiest way to reconnect is by pressing the connect button in my car (ie not on the handset). It re-connects straight away and then works perfectly for the rest of the journey. This happens everytime I am in the car !
I'm fairly sure the problem is with the phone as my Nokia5800 did not have this issue.
View 3 Replies
View Related
Feb 12, 2009
Does SDK 1.1 support an easy way for me to know what network data is sent/received?
View 7 Replies
View Related
Nov 24, 2013
The facebook messenger app for my Samsung Galaxy Fame only receives notifications of messages when connected to a mobile data network, not when connected to wifi. If I swap to solely using mobile data after a conversation, I receive a string of notifications of all the messages I've just been sent in the conversation which is very frustrating.
View 1 Replies
View Related
Aug 4, 2010
Can anybody give me some clue that how to convert binary string into a string(english). I have tried and googled so much but couldn't find an answer.
View 1 Replies
View Related
May 27, 2010
I know that the apps receive a ACTION_SHUTDOWN broadcast event when the device is shutting down.
When an application receives the shutdown, is there still an opportunity to send data packets out, or does android block such attempts(or does the platform tear down the network stack before it can go out).
View 1 Replies
View Related
Aug 20, 2013
I am trying to write a client application which talk to server application via bluetooth. Server application is running on embedded platfrom.
I referred bluetoothchat example for bluetooth data transfer. In my application I have two activities, Main activity shows list of bluetooth devices and when a user clicks on one of the devices it will open a new activity. Then it will open a bluetooth socket start thread to connect to server. I have a message handler which talks to the connected thread.
my codes looks like this
[HIGH]
public class ConnectActivity extends Activity {
// Unique UUID for this application
public static final UUID MY_UUID_INSECURE =
[Code]....
Some times my UI hangs when I click a button, it takes ages to respond back. In my method for ledOn I call bluetooth input stream. Is this correct method to do it.
View 1 Replies
View Related
Aug 18, 2010
I've been having an issue with data integrity using an RFCOMM socket over Bluetooth in Android. I don't have any issues connecting, but the data I receive is garbled and not the same as the data that is sent. The data is sent by an RS232 device over a Bluetooth adapter, which the phone connects to. There isn't a problem with the adapter as the data is properly received if I connect with a laptop.
My Bluetooth connection is handled based off of the BluetoothChat sample application found at the Android developer site(http://developer.android.com/resources/samples/BluetoothChat/index.html), with no changes. The data being sent is plain text and control characters (which are stripped out before display to the user). The specific problem I have is that some of the text is missing, some of it is repeated, etc. The funny thing is if I connect to a computer with a terminal app and type in there, the data is transmitted fine. Additionally, if I connect to the device using the GetBlue app [url] the data is received fine.
So I guess the issue is what does GetBlue possibly do different to handle it's Bluetooth data transfer, or is there another way receive Bluetooth data over an RFCOMM socket on Android?
View 3 Replies
View Related
Mar 13, 2013
I'm developing an application which will print to a blue tooth printer the data that iv'e gathered but i don't know where to start. I'm done with the application that will gather the data. But i'm on a deadlock now. How do i design the file that the printer will print?.
View 1 Replies
View Related
Dec 30, 2009
I want to implement an application which can successfully transfer a file from my android eclair device to any other bluetooth device.Please if anybody know the solutions, kindly help me out, mail me at narendraprabh...@gmail.com or post back here please...
View 3 Replies
View Related
Jul 7, 2010
Just taken delivery of a UK edition Samsung Galaxy S. Connecting it to my car audio via bluetooth no problems but it drops the 3G/H network connection as soon as it connects to the car. Disconnect the Bluetooth and I get the data connection back. Is this deliberate or a bug? It means I can't receive emails etc whilst in my car unless I turn off Bluetooth.
View 1 Replies
View Related
Apr 28, 2010
I'm very new to the Android platform, but i was hoping to write a quick and neat little android app which will receive data from blue tooth and to graph the data. I'm trying to use a LM Technologies LM049 blue tooth adapter to send serial data to my HTC Dersire 2.1 android handset. At the moment i'm trying to just prove i can send ascii characters to the phone. Not quite sure where to begin.
View 2 Replies
View Related
Nov 1, 2010
Iam implementing java code for MYGlucoHealth monitor. I have to catch the bluetooth data through my application and parse it to the readable format. (later i store that in SQLite database). But according to the protocol specification they provided, i cant understand how to read and parse it. i know how to pair the device with my application.But i don't know how to parse the data bytes as per the device specification protocol.Can anyone tell me how to do that. Anybody done with this kind of coding?
View 1 Replies
View Related
Jan 20, 2010
I am trying to save battery and speed up my phone. I know that I can in to setting to disable all these extra features, but I heard from someone that, "even though you disabled it, the phone will still continue to try to pick up these services, like 3G). Is there a app that will fully disable these features?
Also is there anyway up speeding up my phone. I have a Rooted T-Mobile MyTouch 3G w/ the CyanogenMod 4.2.13. I heard that there is a "10MB Hack", but I also heard that it will slow down your games.
View 1 Replies
View Related
Jun 5, 2010
My Incredible paired easily with my Toyota car bluetooth and works great, however. . . . everytime the phone sends or receives data (incoming text or email or looking at the internet or answering a text) it mutes the stereo for a couple seconds. It is as if the phone is preparing to make a call. Anyone have any ideas what is going on here? (of course, I'm only looking at the phone while stopped at a traffic light.)
View 2 Replies
View Related
Oct 5, 2012
I want't adb on my desire. I use Leedroid and there is no adb binary. So I downloaded CM9 (and other) to rip it out. But all I get if I try to start the binary on my device is:
permission denied
View 4 Replies
View Related
Jun 14, 2010
Does Android have a native library that can make a jpeg from binary data from say, a json object?
View 4 Replies
View Related
Aug 2, 2010
I am new to android and I want to read a binary file extension .AMF file.I really need your help this is really urgent.
View 1 Replies
View Related
Aug 5, 2010
Can anybody please tell me how to get double and int value from a binary file. I have tried alot but its giving me wrong values.
View 2 Replies
View Related