recognize the gesture on Android device from my Laptop

Put your problem here if it does not fit any of the other categories.

recognize the gesture on Android device from my Laptop

Postby GaryDigg » Sat Feb 25, 2012 9:38 pm

can someone help me about this.

the android device should capture the gesture and send it to my laptop via usb or wireless. my question is on laptop side. how can i get the finger coordinates or captured gesture from Android device and recognize the gesture???

for example, its running on my laptop image X. I' m doing zoom gesture on my Android device and my laptop should receive and recognize the zoom gesture from Android Device and image X should be zoomed.

thanks so much

Gary

PS: if we interact with Android device and would be recognized our gestures on Laptop is indirect interaction. for this type interactions, do we use the same strategy like direct interaction(i mean directly touch my Multitouch laptop display and recognize Gesture)?
GaryDigg
Freshman
Freshman
 
Posts: 3
Joined: Sat Feb 25, 2012 9:26 pm

Top

Re: recognize the gesture on Android device from my Laptop

Postby Phyll » Sun Feb 26, 2012 12:33 am

Hi Gary,

Here's some thoughts about that.

Well I don't know what kind of hardware you have or how you want to use this idea but it sounds like you want to intercept the driver for some existing OS that has a multitouch display, and be able to feed your inputs from your phone display into it. This way I assume you figure any software ought to be able to use it. Does that sound about right?

If you have a program that can get inputs from the OS or the wireless you will have an easier time I think. Drivers are a class all by themselves usually. Besides that, there are a multitude of other things you will have to know or find out about the whole thing. Sounds like a big project unless you are familiar with these things.

A program could just get preprocessed info like zoom up or zoom down commands from your phone then act on them.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: recognize the gesture on Android device from my Laptop

Postby GaryDigg » Sun Feb 26, 2012 12:54 am

Thanks Phyll for your professionel answer. i think its easier as you think. I have two devices, Android tablet and Laptop.
On Tablet is running some application which can capture Gestures und on Laptop is running a application which shows a image.
I'm interacting first with tablet and is captured for example "Pinch out". This gesture should be sent via Wifo or USB to my Laptop. Application on my laptop is waiting for detected Gesture and as soon as that comes, Image should be pinched out.
thanks
GaryDigg
Freshman
Freshman
 
Posts: 3
Joined: Sat Feb 25, 2012 9:26 pm

Re: recognize the gesture on Android device from my Laptop

Postby Phyll » Sun Feb 26, 2012 5:05 am

Hi Gary,

So then you have four parts I guess.

Detect gestures, send them to laptop, receive them on laptop and act on them.

You need an app that gets the gestures and turns them into commands on the tablet and an application on the laptop to display an image and listen for commands. I think wifi is probably the easiest way to send commands to the laptop.

This isn't all there is to it, but this is one way to make a two way client from Android:

Code: Select all
    public String sendString(String output) {
    String s = output;    
   Socket socket = null;
   DataOutputStream dataOutputStream = null;
   DataInputStream dataInputStream = null;
   try {                  //192.168.0.2  10.0.2.2
       socket = new Socket("192.168.0.2", 8888);
        dataOutputStream = new DataOutputStream(socket.getOutputStream());
        dataInputStream = new DataInputStream(socket.getInputStream());
        byte[] b = s.getBytes("UTF8");
        dataOutputStream.write(b, 0, b.length);
        byte[] d = new byte[1024];
        int n = dataInputStream.read(d);
        int i = 0;
        s = "";
        while (i<n) {
           s = s + (char) d[i];
           i++;
            }//while
        } catch (UnknownHostException e) {   
            s = e.getMessage();
        } catch (IOException e) {
            s = e.getMessage();
      }//catches
            finally {
                if (socket != null) {
                    try {
                        socket.close();
         } catch (IOException e) {
                s = e.getMessage();
             }//catch
          }//if
                if (dataOutputStream != null) {
                    try {
         dataOutputStream.close();
         } catch (IOException e) {
                 s = e.getMessage();
                            }//catch
                    }//if   
                if (dataInputStream != null) {
                    try {
         dataInputStream.close();
         } catch (IOException e) {
                 s = e.getMessage();
                            }//catch
                    }//if       
      }//finally
       return s;
        }//sendstring


Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: recognize the gesture on Android device from my Laptop

Postby GaryDigg » Sun Feb 26, 2012 12:18 pm

thanks Phyll. these four parts are the exactly what i have to do. Detect gestures, send them to laptop, receive them on laptop are not complicated. but fourth part "act the gesture on laptop" is not understandable for me. For instance, application on laptop receive "PinchOut" as command. Do i need to implement PinchOut in my own code on Laptop, or there is some pre-defined class which can do it. i mean
If (received string =="PinchOut") then < do pre-defined Pinch_Out action from Multitouch class >
Or
If (received string =="PinchOut") then <my own code that indicates pinch out action>
Thanx
GaryDigg
Freshman
Freshman
 
Posts: 3
Joined: Sat Feb 25, 2012 9:26 pm

Re: recognize the gesture on Android device from my Laptop

Postby Phyll » Sun Feb 26, 2012 1:05 pm

Hi Gary,

Well that depends on how you are showing the image on your laptop.

Like I said, the only way to have it work on any application on the laptop would be to have it intercept or replace the touch driver. Then it would work for any image showing application that was aware of touch events. That's probably difficult, requiring a lot of knowledge about how your laptop works. You might want to see if there's any way to inject events like that into whatever passes for an event queue on this machine. Makes it kind of manufacturer dependent too or at least OS dependent.

The other way, is to make your own viewer that is also the server for your commands from the tablet. That should be much easier. Now you can zoom the displayed image or whatever you want to do with it when a command comes in. Much less useful I would think.

Either way, you need to be able to write code and have a development environment for your laptop as well. I don't even know what kind of laptop you have. There are three working laptops around here, none of them have a touch display. Not very common in the past.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests