making an app for small file transfer to specific device

match417

Member
Sep 24, 2010
37
0
0
I tried to make the subject as small as possible while still stating my point.

Basically I work with a device a lot that runs some machinery. There is a file that is sometimes updated to run the machinery better, we usually update the file on the device when some aspects of the equipment are changed. The file is pushed onto the device using software on my laptop. The software on the laptop is written in C++. I want to make a light version to run on my android phone.

My idea is to create a simple program to run on my android phone that will push the file onto the device after it's edited for changes to the equipment. I opened the C++ exe program in a decompiler (rec4) and I started trying to dig through the code, there are soooo many lines of code in this program, and I don't even know what string to look for. I'm trying to find the exact string that pushes the file to the string so I will know how to write the exact thing in an android program language for my phone only to push the file to the device after I plug it in through the USB connection. That way I have a simplified version of the program running on my phone solely for pushing the file to the device, instead of carrying my laptop around all the time to push a little file.

In a nutshell, after I have described why I need this, I'll simplify everything. A program I have is written in C++ and it pushes a simple file to the flash memory of a device that runs some equipment. I want to be able to push the file from my phone instead of my laptop. So I want to know the string to look for that would push a file onto flash memory.

How the program works. If I have the program already running when I plug in the USB, I have to select "file", then "establish connection" so that it connects, The program appears on my laptop to reconfigure it. I search for the new file to replace the old one and send it to the device. By default the program tries over COM1. It has to be changed for my laptop because it's new and doesn't have the com1 connection, I have a USB adapter that I use.

I hope I explained this well enough, it's really not as complicated as I'm making it out to be.

So does anyone know where I can look up the C++ command arguments to push the file onto the device? And also what the command arguments would be for android to push the file onto the device via USB?
 

The_R

Senior Member
Jan 18, 2011
162
46
0
Hello,

If you are a developer you might want to look at this link:

http://developer.android.com/reference/android/hardware/usb/package-summary.html

If you aren't, I am afraid this isn't going to be as simple as looking for strings in a decompiled program and translating the code to different languages. You might want to get a developer to make this application for you.

If possible can you also give more info on this device? Is it like you plug in the device to your laptop and you can access it like any USB memory drive? Or the device can only be accessed using that program?

Edit:
The android.hardware.usb was apparently introduced in Android 3.1. So you won't be able to use that to make an application that you described for your phone...
 
Last edited:

match417

Member
Sep 24, 2010
37
0
0
The device basically controls an advanced machine with multiple inputs sensors and output and switches. It has it's own power supply, it just needs updating every now and then to refine/change the cycles and rotations. I contacted the company that makes the device, and they said they haven't made any software to run on android. They couldn't give me any information on how the laptop program communicates with the device. It seems like the file that needs editing is just stored back on the device in flash memory. When the laptop is plugged in and a connection is established, the information that makes up the configuration file appears on the laptop program from the device. I don't know if the program pulls and reads the file, or if the device copies it to the laptop. It's probably the laptop that reads it.

I'm not a developer, I know a little about programming from college, and I have enough patience to sit and read or watch videos until I know how to make something that works. I know a guy that talks a lot about making android programs, maybe I can ask him for pointers.

My android phone has a mini USB port, what's the new thing that's in android 3.1 that's not in my 2.2 regarding USB? Is the USB on the android 2.2 limited in what it can do? I know mine can tether and transfer files, but is that something that the computer does instead of the phone?

I'm trying to find another HTC HD2, I sold mine and I shouldn't have. I've heard a little about people putting android 3.1 on the HD2, I'm not sure if that's true, but I'll look more into it.
 
Last edited:

The_R

Senior Member
Jan 18, 2011
162
46
0
If its a file that the device is reading the data from, you'd also have to find out how the data is exactly being stored in the file. I guess this could be figured out through the decompiled program or maybe if you can access the file yourself somehow.

The thing is that the package(android.hardware.usb) that allows you to write applications in which your phone can act as a USB host(I guess this is what you want your phone to behave like in this case) was introduced in Android 3.1 and its not present in Android 2.2.

That doesn't necessarily mean that you cannot have such an application on your phone. It just means that you cannot use the Android Java API to make something like this. I am not too sure how it can be done but I guess it is possible to make an application like the one you want that runs on a rooted phone maybe?

I am sure anyone can learn to write programs/applications but its just that you'd have to put in a lot of time and effort to make something like this. If you are in no rush to have the application ready then its fine if you learn to make it yourself. And since its a custom made application and the people who made it aren't willing to help you by giving info on it just makes it that much harder for you.
 

match417

Member
Sep 24, 2010
37
0
0
yeah, when I get another HD2 it's getting rooted with android, I just have to find one. Since I sold mine they have made it to where you can run android off of internal memory, so I'm itching to get it back.

The laptop program also has the option to save the configuration file locally, I haven't thought about looking through that. I didn't think it would tell me much.

So theoretically, if I were to write a program for the android phone with usb transfer capability to the device in question would it work? It doesn't bother me if I have to root my phone.
 

The_R

Senior Member
Jan 18, 2011
162
46
0
If the device is reading data in from the file, and you wish to write a program that creates this file, you will have to take care that the program you are making writes the file in very same format and saves the file back in the same location on the device where it will look for this file later.

If you made this application for an android device that has USB Hosting capabilities, it should work (as far as I know).

The question is: How can you get your phone to have USB Hosting capability? I don't know if rooting your phone would do it. You'll have to find out about this.