Message Boards Message Boards

Using your smart phone as the ultimate sensor array for Mathematica

POSTED BY: Marco Thiel
15 Replies
POSTED BY: Jack I Houng

IS there a way to associate the WM code to the phone running on a separate network? Let say that the Phone is running using its own Data Service but my computer is in a separate network. Where do I place the IP in the code since I do not see this address anywhere in the code.

POSTED BY: Jose Calderon
POSTED BY: Salvador Romo
POSTED BY: Fred Klingener
Posted 9 years ago

Marco,

Can you explain this code fragment from your JLink processing?

packet = JavaNew["java.net.DatagramPacket", JavaNew["[B", 1024], 1024];
POSTED BY: David G
Posted 9 years ago
POSTED BY: David G

Thanks. I'll try it out. I'm running OSX 10.10.5 on my laptop, and Mathematica 10.3.

But I was also trying to run it through the cloud so I could access it from the phone through the Wolfram Cloud app. Where I was seeing blue was on on dev.wolframcloud.com/.

POSTED BY: Kathryn Cramer
POSTED BY: Kathryn Cramer
Attachments:
POSTED BY: Marco Thiel
Posted 9 years ago
POSTED BY: Alexey Popkov

Hi Alexey,

yes there are loads. We also wrote a little piece of code for Androids. It is somewhere on the Android Store. I will try to "extract" the program from a Post-Doc and post it here.

Cheers,

Marco

POSTED BY: Marco Thiel

Hi Marco and Alexey,

The app is called "Sensors Prototype" and it can be found in Google Play. We have tried it on the samsung S3 and S4 without issues. We wrote the following code in Java (server side) to test the data streaming:

import java.io.*;
import java.net.*;

    class serverUDP
    {   
        public static void main(String argv[]) throws Exception,IOException {
        System.out.println("    Server is Running ");       
        System.out.println("    In port :" + argv[0]);
        DatagramSocket serverSocket = new DatagramSocket(Integer.parseInt(argv[0]));
        byte[] receiveData = new byte[1024];

        while(true)
        {
            System.out.println("-----------------------");
            DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
            serverSocket.receive(receivePacket);
            String output = new String(receivePacket.getData());
            System.out.println("Received: " + output);
            System.out.println("-----------------------");
        }
       }
    }

Of course, both mobile and server should be on the same network

Regards Ricardo

Posted 9 years ago

okey, the Mathematica code is written to get the streaming data for any source connected into that ip address and port?

By the way, this will help me out...

Thanks

POSTED BY: Fabio Burgos
Posted 10 years ago
POSTED BY: Benjamin Stuart
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract