{"id":55,"date":"2013-02-17T09:45:52","date_gmt":"2013-02-17T16:45:52","guid":{"rendered":"http:\/\/ainslies.net\/?p=55"},"modified":"2013-04-16T21:03:22","modified_gmt":"2013-04-17T04:03:22","slug":"imwatch-sensors","status":"publish","type":"post","link":"https:\/\/ainslies.net\/?p=55","title":{"rendered":"i&#8217;m Watch Sensors"},"content":{"rendered":"<p>After almost a year the IMWatch developer site has finally released a library to access the sensors. They even released an <a href=\"http:\/\/imdeveloper.it\/download.php\" target=\"_blank\">example<\/a> application but no documentation ???<\/p>\n<p>Fortunately there are some <a href=\"http:\/\/java.decompiler.free.fr\/?q=jdgui\" target=\"_blank\">tools<\/a> to decompile java apps.<\/p>\n<p>Below are the prototypes for the two undocumented functions the you&#8217;ll need to use to get access to the sensors.<\/p>\n<pre>public SensorServiceInstance(int updateInterval)\r\npublic SimpleShakeDetector(Context context, OnShakeListener listener, int updateInterval)<\/pre>\n<p>The\u00a0important\u00a0argument\u00a0here is the updateInterval. It&#8217;s an int but what does it represent. A few tests show it&#8217;s the number of milliseconds between samples. Reading the decompiled code implies that this value must be greater than zero but has no other limits.<\/p>\n<p>The application I&#8217;m writing needs to have a 200Hz update rate so I tried setting this value to 5 ms. This doesn&#8217;t get the required update rate. It seems the practical lower limit to updateInterval is 100ms which doesn&#8217;t even match the game update interval for the Android standard sensors updates. 10 Hz isn&#8217;t even the lowest rate I can use for my application.<\/p>\n<p>Digging deeper into the sources looks like they have included a native i2c library to access the sensors. I might be able to use that to get direct access and increase the update rate. Stay posted for a blog post on where I get with that.<\/p>\n<p>The full decompile source is available <a href=\"http:\/\/akkea.ca\/files\/imwatch_sensors.tgz\">here<\/a>.<\/p>\n<p>Once again IMWatch has underwhelmed with no documentation and a marginally functional sensor library.\u00a0\u00a0Another release, another fail.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After almost a year the IMWatch developer site has finally released a library to access the sensors. They even released an example application but no documentation ??? Fortunately there are some tools to decompile java apps. Below are the prototypes &hellip; <a href=\"https:\/\/ainslies.net\/?p=55\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-android-devices","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=55"}],"version-history":[{"count":11,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":303,"href":"https:\/\/ainslies.net\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions\/303"}],"wp:attachment":[{"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ainslies.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}