wp7 record your own accelerometer data for testing
In the recent Mango developer tools for Windows Phone the device emulator has been updated to include an accelerometer simulation screen.
This enables passing data in real time to your application via the Accelerometer. Also, you can play back some recorded data, of which there is some sample ‘Shake’ data. So pressing Play will play back the recorded data.
The shake data is stored as xml from this location ‘<PROGRAM FILES>Microsoft XDE1.0sensordataacc’ in a file called ‘Shake’. The format is very simple as can be seen from the screenshot below;
Now, the next bit happened by accident as I was trying to think of something simple to implement with sockets just so I could become familiar with the socket support on Mango. Anyway, I started by writing the obligatory client / server socket code. The server being a console app which listens for client connections on a tcp port.
Once connected, the client sends accelerometer reading data over the connection to the server which saves it to xml in the required format.
So to record a file, start the server console app, then run the mango app on the emulator. Start the accelerometer tools…
…manipulate the input data using the pink blob on the tools in the required motion. The data will be sent via the Accelerometer interface in the phone app, across the socket connection to the console app which will save it to an xml file when the recording ends.
The resulting file will subsequently end up in the drop-down on the Accelerometer Tools ui;
<p>Probably not the best way to record the data but it allowed me to play around with the socket api’s </p> <p><img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="/assets/images/2011/06/wlemoticon-smile.png" /></p> <p>Source code is here <a title="http://cid-4f1b7368284539e5.office.live.com/self.aspx/.Public/AccelerometerRecorder/AccelerometerRecorderServer.zip" href="http://cid-4f1b7368284539e5.office.live.com/self.aspx/.Public/AccelerometerRecorder/AccelerometerRecorderServer.zip">http://cid-4f1b7368284539e5.office.live.com/self.aspx/.Public/AccelerometerRecorder/AccelerometerRecorderServer.zip</a></p> Technorati Tags: <a href="http://technorati.com/tags/wp7dev" rel="tag">wp7dev</a>,<a href="http://technorati.com/tags/Mango" rel="tag">Mango</a>,<a href="http://technorati.com/tags/tools" rel="tag">tools</a>,<a href="http://technorati.com/tags/simulation" rel="tag">simulation</a>,<a href="http://technorati.com/tags/Shake" rel="tag">Shake</a>,<a href="http://technorati.com/tags/location" rel="tag">location</a>,<a href="http://technorati.com/tags/Microsoft" rel="tag">Microsoft</a>,<a href="http://technorati.com/tags/socket" rel="tag">socket</a>,<a href="http://technorati.com/tags/client" rel="tag">client</a>,<a href="http://technorati.com/tags/server" rel="tag">server</a>,<a href="http://technorati.com/tags/code" rel="tag">code</a>,<a href="http://technorati.com/tags/port" rel="tag">port</a>,<a href="http://technorati.com/tags/connection" rel="tag">connection</a>,<a href="http://technorati.com/tags/AccelerometerRecorder" rel="tag">AccelerometerRecorder</a>,<a href="http://technorati.com/tags/sockets" rel="tag">sockets</a>,<a href="http://technorati.com/tags/emulator" rel="tag">emulator</a> <br /> Windows Live Tags: <a href="http://windows.live.com/connect/tag/wp7dev" rel="clubhouseTag">wp7dev</a>,<a href="http://windows.live.com/connect/tag/Mango" rel="clubhouseTag">Mango</a>,<a href="http://windows.live.com/connect/tag/tools" rel="clubhouseTag">tools</a>,<a href="http://windows.live.com/connect/tag/simulation" rel="clubhouseTag">simulation</a>,<a href="http://windows.live.com/connect/tag/Shake" rel="clubhouseTag">Shake</a>,<a href="http://windows.live.com/connect/tag/location" rel="clubhouseTag">location</a>,<a href="http://windows.live.com/connect/tag/Microsoft" rel="clubhouseTag">Microsoft</a>,<a href="http://windows.live.com/connect/tag/socket" rel="clubhouseTag">socket</a>,<a href="http://windows.live.com/connect/tag/client" rel="clubhouseTag">client</a>,<a href="http://windows.live.com/connect/tag/server" rel="clubhouseTag">server</a>,<a href="http://windows.live.com/connect/tag/code" rel="clubhouseTag">code</a>,<a href="http://windows.live.com/connect/tag/port" rel="clubhouseTag">port</a>,<a href="http://windows.live.com/connect/tag/connection" rel="clubhouseTag">connection</a>,<a href="http://windows.live.com/connect/tag/AccelerometerRecorder" rel="clubhouseTag">AccelerometerRecorder</a>,<a href="http://windows.live.com/connect/tag/sockets" rel="clubhouseTag">sockets</a>,<a href="http://windows.live.com/connect/tag/emulator" rel="clubhouseTag">emulator</a> <br /> WordPress Tags: <a href="http://wordpress.com/tag/wp7dev" rel="Tag">wp7dev</a>,<a href="http://wordpress.com/tag/Mango" rel="Tag">Mango</a>,<a href="http://wordpress.com/tag/tools" rel="Tag">tools</a>,<a href="http://wordpress.com/tag/simulation" rel="Tag">simulation</a>,<a href="http://wordpress.com/tag/Shake" rel="Tag">Shake</a>,<a href="http://wordpress.com/tag/location" rel="Tag">location</a>,<a href="http://wordpress.com/tag/Microsoft" rel="Tag">Microsoft</a>,<a href="http://wordpress.com/tag/socket" rel="Tag">socket</a>,<a href="http://wordpress.com/tag/client" rel="Tag">client</a>,<a href="http://wordpress.com/tag/server" rel="Tag">server</a>,<a href="http://wordpress.com/tag/code" rel="Tag">code</a>,<a href="http://wordpress.com/tag/port" rel="Tag">port</a>,<a href="http://wordpress.com/tag/connection" rel="Tag">connection</a>,<a href="http://wordpress.com/tag/AccelerometerRecorder" rel="Tag">AccelerometerRecorder</a>,<a href="http://wordpress.com/tag/sockets" rel="Tag">sockets</a>,<a href="http://wordpress.com/tag/emulator" rel="Tag">emulator</a>
Comments