
SmartWatch MN2用のアプリです。LiveWare extension for SmartWatch.
本アプリ単体では、何も機能しません。
通常のAndroidアプリから画像情報などを受け取って、SmartWatchに表示するツールです。本アプリが起動していれば、SmartWatch専用のアプリを作らなくても、intentを使用してSmartWatchに画像を転送することが出来ます。
本アプリは、起動と同時にBitmap画像とバイブレータ制御情報のBroadcastを待ち続けます。画像を送信したい場合は、下記のようなプログラムを作成してください。
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.PNG, 100, baos);
byte[] bytebmp = baos.toByteArray();
Intent intent = new Intent("com.luaridaworks.extras.BITMAP_SEND");
intent.putExtra( "BITMAP", bytebmp);
sendBroadcast(intent);
画面より大きな画像は表示オフセット座標を指定できます。
Ver 1.1から仕様変更しました。X,Yのオフセット値を個別に設定してください。
intent.putExtra( "OFFSETX", 130 );
intent.putExtra( "OFFSETY", 60 );
ただし、「受信画像全体を表示する」にチェックを入れた場合は、画像全体が画面に収まるように表示されます。
バイブレータ情報を送信したい場合は、下記のようなプログラムを作成してください。
Intent intent = new Intent("com.luaridaworks.extras.VIBRATOR_SEND");
intent.putExtra("ONTIME", 2000 );
intent.putExtra("OFFTIME", 500 );
intent.putExtra("REPAET", 2 );
sendBroadcast(intent);
ONTIME, OFFTIME, REPEATのキーワードで数値をセットしてください。上の例では、2秒間振動し、0.5秒間停止するを2回繰り返します。
ONTIMEのみの送信も可能です。
REPAETを 0として送信するとバイブレータは停止します。
Ver 1.1より、画面タッチ及び画面スィープ結果をBroadcast送信するようにしました。
よって、各アプリでSmartWatchへのタッチアクションを取得することが出来ます。
intent-filterに、"com.luaridaworks.extras.TOUCH_SEND" と "com.luaridaworks.extras.SWIPE_SEND" を追加してください。
BroadcastReceiverでの受信は下記のような感じで受け取ってください。
int action = (Integer)intent.getSerializableExtra("ACTION");
int x = (Integer)intent.getSerializableExtra("TOUCHX");
int y = (Integer)intent.getSerializableExtra("TOUCHY");
int direction = (Integer)intent.getSerializableExtra("DIRECTION");
direction 0:UP, 1:DOWN: 2:LEFT, 3:RIGHT です。
Ver 1.2より、センサーの値を取得できるようにしました。
センサー値を取得するためには、"com.luaridaworks.extras.SENSOR_REQUEST"をBroadcast送信します。これを送信すると、Bitmapキャッチャはセンサーの値をBroadcastで返してきます。
Intent intent = new Intent("com.luaridaworks.extras.SENSOR_REQUEST");
sendBroadcast(intent);
センサーの値を受信するには、intent-filterに、"com.luaridaworks.extras.SENSOR_SEND"を追加してください。
BroadcastReceiverの受信は下記のような感じで受け取ってください。
Float x = (Float)intent.getSerializableExtra("SENSORX");
Float y = (Float)intent.getSerializableExtra("SENSORY");
Float z = (Float)intent.getSerializableExtra("SENSORZ");
Ver1.4から画面表示モードをBroadcastで設定できるようになりました。
送信手順は下記のようになります。
受信画像全体を表示する場合、
intent = new Intent(\"com.luaridaworks.extras.DISPLAY_SEND\");
intent.putExtra("WHOLE", true);
sendBroadcast(intent);
受信画像全体を表示しない場合、
intent = new Intent(\"com.luaridaworks.extras.DISPLAY_SEND\");
intent.putExtra("WHOLE", false);
sendBroadcast(intent);
画面を消す場合、
intent = new Intent(\"com.luaridaworks.extras.DISPLAY_SEND\");
intent.putExtra("SCREEN", 0);
sendBroadcast(intent);
画面を暗くする場合、
intent = new Intent(\"com.luaridaworks.extras.DISPLAY_SEND\");
intent.putExtra("SCREEN", 1);
sendBroadcast(intent);
画面を表示する場合、
intent = new Intent(\"com.luaridaworks.extras.DISPLAY_SEND\");
intent.putExtra("SCREEN", 2);
sendBroadcast(intent);
自動的にスリープする場合、
intent = new Intent(\"com.luaridaworks.extras.DISPLAY_SEND\");
intent.putExtra("SCREEN", 3);
sendBroadcast(intent);
SmartWatch is MN2 app for. LiveWare extension for SmartWatch.
In this application alone, nothing will not work.
Receiving and image information from the normal Android app is a tool to be displayed in the SmartWatch. If you start this app, even if not made the SmartWatch dedicated app, you can transfer the image to the SmartWatch using the intent.
This application, start-up and will continue to wait for the Broadcast of the Bitmap image and vibrator control information at the same time. If you want to send the image, please create a program such as the following.
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
bitmap.compress (CompressFormat.PNG, 100, baos);
byte [] bytebmp = baos.toByteArray ();
Intent intent = new Intent ( "com.luaridaworks.extras.BITMAP_SEND");
intent.putExtra ( "BITMAP", bytebmp);
sendBroadcast (intent);
Larger image than the screen you can specify the display offset coordinates.
It has been changed specification from Ver 1.1. X, please be individually set the offset value of Y.
intent.putExtra ( "OFFSETX", 130);
intent.putExtra ( "OFFSETY", 60);
However, if you put a check in "to display the entire received image", it will be displayed so that the entire image fits on the screen.
If you want to send a vibrator information, please create a program such as the following.
Intent intent = new Intent ( "com.luaridaworks.extras.VIBRATOR_SEND");
intent.putExtra ( "ONTIME", 2000);
intent.putExtra ( "OFFTIME", 500);
intent.putExtra ( "REPAET", 2);
sendBroadcast (intent);
ONTIME, OFFTIME, please set the numerical value in the REPEAT keyword. In the above example, vibrates for 2 seconds, then repeat twice to stop 0.5 seconds.
Transmission of ONTIME only is also available.
When you send a REPAET as 0 vibrator is stopped.
Than Ver 1.1, touch the screen and the screen sweep result was to be Broadcast transmission.
Thus, you can get a touch action to the SmartWatch in each application.
In the intent-filter, please add a "com.luaridaworks.extras.TOUCH_SEND" and "com.luaridaworks.extras.SWIPE_SEND".
Reception in the BroadcastReceiver, please received something like the following.
int action = (Integer) intent.getSerializableExtra ( "ACTION");
int x = (Integer) intent.getSerializableExtra ( "TOUCHX");
int y = (Integer) intent.getSerializableExtra ( "TOUCHY");
int direction = (Integer) intent.getSerializableExtra ( "DIRECTION");
direction 0: UP, 1: DOWN: 2: LEFT, 3: is RIGHT.
Than Ver 1.2, it was to be able to get the value of the sensor.
In order to get the sensor value, Broadcast send a "com.luaridaworks.extras.SENSOR_REQUEST". When you send it, Bitmap catcher will come Returns the value of the sensor in the Broadcast.
Intent intent = new Intent ( "com.luaridaworks.extras.SENSOR_REQUEST");
sendBroadcast (intent);
To receive the value of the sensor is, the intent-filter, please add a "com.luaridaworks.extras.SENSOR_SEND".
Reception of BroadcastReceiver, please received something like the following.
Float x = (Float) intent.getSerializableExtra ( "SENSORX");
Float y = (Float) intent.getSerializableExtra ( "SENSORY");
Float z = (Float) intent.getSerializableExtra ( "SENSORZ");
The screen display mode from Ver1.4 can now be set in the Broadcast.
Transmission procedure is as follows.
To display the entire received image,
intent = new Intent (\ "com.luaridaworks.extras.DISPLAY_SEND \");
intent.putExtra ( "WHOLE", true);
sendBroadcast (intent);
If you do not see the entire received image,
intent = new Intent (\ "com.luaridaworks.extras.DISPLAY_SEND \");
intent.putExtra ( "WHOLE", false);
sendBroadcast (intent);
If you turn off the screen,
intent = new Intent (\ "com.luaridaworks.extras.DISPLAY_SEND \");
intent.putExtra ( "SCREEN", 0);
sendBroadcast (intent);
If you want to dim the screen,
intent = new Intent (\ "com.luaridaworks.extras.DISPLAY_SEND \");
intent.putExtra ( "SCREEN", 1);
sendBroadcast (intent);
If you want to view the screen,
intent = new Intent (\ "com.luaridaworks.extras.DISPLAY_SEND \");
intent.putExtra ( "SCREEN", 2);
sendBroadcast (intent);
Automatically If you want to sleep,
intent = new Intent (\ "com.luaridaworks.extras.DISPLAY_SEND \");
intent.putExtra ( "SCREEN", 3);
sendBroadcast (intent);