blog

Remotair — blog.yoz.sk/2010/12/remotair/

Remotair is a concept of transmitting device input events (gestures, accelerometer, camera etc.) into receiving flash or AIR application. Remotair consists of one transmitting application installed on a mobile device or a tablet and one receiving application running on a PC. In order to pair transmitting and receiving application, RTMFP protocol is used. The receiver API is public and released under MIT license.

You can download Remotair application from Android market (link only works on android devices) or see the Android application details on AppBrain. For a receiving application you may use the demo application located on remotair.yoz.sk or you can build your own one using Remotair Receiver API.

What is remotair capable of?

The current version of Remotair transmitter is available for Android devices and is capable of transmit touch events and gestures, keyboard events (using native keyboard or custom buttons), accelerometer, geolocation/GPS microphone and camera. Accelerometer, geolocation, microphone and camera can be transmitted in background mode, that means user can interact with touch or keys while mentioned sensors/inputs are being transmitted at the same time (e.g. accelerometer + camera + gestures).

How can I use it?

For now, to see what is Remotair all about, install transmitter application to your Android device and click connect. Once you get the channel number, run receiver demo. Now those two apps connects via P2P. Once they are connected, you can start clicking different views in transmitter and see the log or custom event handling view on receiver side.

Demo video featuring Keyboard, Mouse, Touch, Gesture, Accelerometer, Geolocation, Camera, Microphone:

Remotair Loves onBoard – Using samsung galaxy tab to remotely control system mouse using Remotair android app.

Shumps with Remotair – Playing Shmups with Remotair http://wonderfl.net/c/dqyi using nexus one

Live video transmitting from RC car – Live video transmmitting from an Android mounted on a RC-ed toy using #remotair

Imagine you have a RC model of a car or a helicopter, you can mount your mobile device onto it, turn transmitting camera and microphone on and you are ready to controll the model while sitting before PC see and hear everything. Or, you build and cutting edge flash game that can be controlled by accelerometer and joysticks etc.

Remotair Receiver API

All the necessary classes can be downloaded from classes.yoz.sk. Check out the demo application built over the api on remotair.yoz.sk. The basic application may look something like this:

import flash.events.AccelerometerEvent;
import sk.yoz.remotair.events.GenericConnectorEvent;
import sk.yoz.remotair.net.GenericConnector;
import sk.yoz.remotair.net.Receiver;

private var receiver:Receiver = new Receiver(
	GenericConnector.HANDSHAKE_URL,
	GenericConnector.DEVELOPER_KEY,
	GenericConnector.CHANNEL_SERVICE);

private function connect(channel:String):void // channel = 1234 etc.
{
	receiver.connectChannel(channel);
	receiver.addEventListener(GenericConnectorEvent.PEER_CONNECTED, onPeerConneceted);
	receiver.accelerometerEvents.addEventListener(AccelerometerEvent.UPDATE, onAccelerometerUpdate);
}

private function onPeerConneceted(event:GenericConnectorEvent):void
{
	// transmitting application on your device is now connected with this app
}

private function onAccelerometerUpdate(event:AccelerometerEvent):void
{
	trace(event.accelerationX, event.accelerationY);
}

Transmitter

Here is a list of events dispatched with each view on transmitter. The most of those are native ActionScript events, plus some custom:

Keyboard View

TextEvent: TextEvent.TEXT_INPUT

TextEvent: RemotairEvent.TEXT_CHANGE

KeyboardEvent: KeyboardEvent.KEY_DOWN

KeyboardEvent: KeyboardEvent.KEY_UP

Numbers and Arrows View

KeyboardEvent: KeyboardEvent.KEY_DOWN

KeyboardEvent: KeyboardEvent.KEY_UP

Gamepad View

KeyboardEvent: KeyboardEvent.KEY_DOWN

KeyboardEvent: KeyboardEvent.KEY_UP

JoystickEvent: JoystickEvent.CHANGE

Mouse View

MouseEvent: MouseEvent.MOUSE_DOWN

MouseEvent: MouseEvent.MOUSE_MOVE

MouseEvent: MouseEvent.MOUSE_UP

MouseEvent: MouseEvent.CLICK

MouseEvent: RemotairEvent.MOUSE_LEFT_DOWN

MouseEvent: RemotairEvent.MOUSE_LEFT_UP

MouseEvent: RemotairEvent.MOUSE_LEFT_CLICK

MouseEvent: RemotairEvent.MOUSE_RIGHT_DOWN

MouseEvent: RemotairEvent.MOUSE_RIGHT_UP

MouseEvent: RemotairEvent.MOUSE_RIGHT_CLICK

Touch View

TouchEvent: TouchEvent.TOUCH_BEGIN

TouchEvent: TouchEvent.TOUCH_END

TouchEvent: TouchEvent.TOUCH_MOVE

TouchEvent: TouchEvent.TOUCH_OUT

TouchEvent: TouchEvent.TOUCH_OVER

TouchEvent: TouchEvent.TOUCH_ROLL_OUT

TouchEvent: TouchEvent.TOUCH_ROLL_OVER

TouchEvent: TouchEvent.TOUCH_TAP

Gestures View

GestureEvent: GestureEvent.GESTURE_TWO_FINGER_TAP

PressAndTapGestureEvent: PressAndTapGestureEvent.GESTURE_PRESS_AND_TAP

TransformGestureEvent: GestureEvent.GESTURE_PAN

TransformGestureEvent: TransformGestureEvent.GESTURE_ROTATE

TransformGestureEvent: TransformGestureEvent.GESTURE_SWIPE

TransformGestureEvent: TransformGestureEvent.GESTURE_ZOOM

Joystick View

JoystickEvent: JoystickEvent.CHANGE

Accelerometer View

AccelerometerEvent: AccelerometerEvent.UPDATE

StatusEvent: StatusEvent.STATUS

Camera View

The main function of this view is to attachCamera over NetStream, that can be handled by Receiver.stream

CameraEvent: CameraEvent.CAMERA_PUBLISHED

CameraEvent: CameraEvent.CAMERA_UNPUBLISHED

CameraEvent: CameraEvent.CAMERA_UPDATED

Microphone View

The main function of this view is to attachAudio over NetStream, that can be handled by Receiver.stream

MicrophoneEvent: MicrophoneEvent.MICROPHONE_PUBLISHED

MicrophoneEvent: MicrophoneEvent.MICROPHONE_UNPUBLISHED

MicrophoneEvent: MicrophoneEvent.MICROPHONE_UPDATED

Geolocation View

GeolocationEvent: GeolocationEvent.UPDATE

StatusEvent: StatusEvent.STATUS

Receiver

Transmitted events are dispatched into Receiver class. You may notice there are some custom events, that should be selfexplanatory by code or once debuged.

Receiver.remotairEvents: RemotairEvent

Receiver.viewEvents: ViewEvent

Receiver.mouseEvents: MouseEvent

Receiver.keyboardEvents: KeyboardEvent

Receiver.textEvents: TextEvent

Receiver.joystickEvents: JoystickEvent

Receiver.cameraEvents: CameraEvent

Receiver.microphoneEvents: MicrophoneEvent

Receiver.activityEvents: ActivityEvent

Receiver.statusEvents: StatusEvent

Receiver.accelerometerEvents: AccelerometerEvent

Receiver.touchEvents: TouchEvent

Receiver.gestureEvents: PressAndTapGestureEvent, TransformGestureEvent, GestureEvent

Receiver.geolocationEvents: GeolocationEvent

More reading:

RTMFP Connection Tester

Ports Required For RTMFP

P2P in Desktop, Mobile, and Tablet Flex Apps

MAX Racer Remote Device Controller in AIR for Android