API Reference¶
For the examples, we’ll use Resty
$ . resty
$ resty http://127.0.0.1:8083
http://127.0.0.1:8083*
Example response of a successful request:
HTTP/1.1 204 No Content
CONTENT-LENGTH: 0
CONNECTION: keep-alive
DATE: Wed, 04 Nov 2015 10:32:40 GMT
SERVER: Python/3.5 aiohttp/0.18.3
Accelerometer¶
-
POST
/android/sensors/accelerometer/{avm_id}
¶ Example request:
$ POST /android/sensors/accelerometer/jHLGWPeRSVyVzyCpWRsEjg \ '{"x":"0","y":"0.5","z":"1.0"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - x (float) – orientation vector x
- y (float) – orientation vector y
- z (float) – orientation vector z
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Battery¶
-
POST
/android/sensors/battery/{avm_id}
¶ Example request:
$ POST /android/sensors/battery/jHLGWPeRSVyVzyCpWRsEjg '{"level":40}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - level (int) – the battery level
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Camera¶
-
POST
/android/sensors/camera/{avm_id}
¶ Example request:
$ POST /android/sensors/camera/jHLGWPeRSVyVzyCpWRsEjg '{"file_id":"zebre.mpg"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - file_id (string) – the name of the video file (or in the cloud version or AiC, the file id) to be found under the folder $SENZA_CAMERA_VIDEO_PATH
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
GPS¶
-
POST
/android/sensors/gps/{avm_id}
¶ Example request:
$ POST /android/sensors/gps/jHLGWPeRSVyVzyCpWRsEjg \ '{"latitude":48.8567,"longitude":2.3508}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - latitude (float) – the latitude (+ is North, - is South)
- longitude (float) – the longitude (+ is East, - is West)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Gravity¶
-
POST
/android/sensors/gravity/{avm_id}
¶ Example request:
$ POST /android/sensors/gravity/jHLGWPeRSVyVzyCpWRsEjg \ '{"x": 0, "y": 9.776, "z": 0.813}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - x (float) – gravity vector x
- y (float) – gravity vector y
- z (float) – gravity vector z
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
GSM¶
Call¶
-
POST
/android/sensors/gsm/call/{avm_id}
¶ Example request:
$ POST /android/sensors/gsm/call/jHLGWPeRSVyVzyCpWRsEjg \ '{"action": "receive", "phone_number": "+3312345"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - action (string) – Action type to perform (one of “accept”, “cancel”, “hold”, “receive”)
- phone_number (string) – The (remote) phone number used for the call action
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Network¶
-
POST
/android/sensors/gsm/network/{avm_id}
¶ Example request:
$ POST /android/sensors/gsm/network/jHLGWPeRSVyVzyCpWRsEjg '{"type": "lte"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - type (string) – The network type to use (one of “gsm”, “gprs”, “edge”, “cdma”, “hspa”, “hsupa”, “umts”, “hsdpa”, “evdo”, “lte”, “full”)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Registration¶
-
POST
/android/sensors/gsm/registration/{avm_id}
¶ Example request:
$ POST /android/sensors/gsm/registration/jHLGWPeRSVyVzyCpWRsEjg '{"type": "home"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - type (string) – The gsm registration type to use (one of “home”, “denied”, “searching”, “roaming”, “none”)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Signal¶
-
POST
/android/sensors/gsm/signal/{avm_id}
¶ Example request:
$ POST /android/sensors/gsm/signal/jHLGWPeRSVyVzyCpWRsEjg '{"strength": 3}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - strength (string) – The sms strength (between 0, the minimum, and 4, the maximum)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Sms¶
-
POST
/android/sensors/gsm/sms/{avm_id}
¶ Example request:
$ POST /android/sensors/gsm/sms/jHLGWPeRSVyVzyCpWRsEjg \ '{"phone_number": "+3312345", "text": "Bonjour"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - phone_number (string) – The (remote) phone number the sms will be received from
- text (string) – The sms text to be received
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Gyroscope¶
-
POST
/android/sensors/gyroscope/{avm_id}
¶ Example request:
$ POST /android/sensors/gyroscope/jHLGWPeRSVyVzyCpWRsEjg \ '{"azimuth": 0, "pitch": 9.776, "roll": 0.813}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - azimuth (float) – device azimuth in degrees
- pitch (float) – device pitch in degrees
- roll (float) – device roll in degrees
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Light¶
-
POST
/android/sensors/light/{avm_id}
¶ Example request:
$ POST /android/sensors/light/jHLGWPeRSVyVzyCpWRsEjg '{"light": 90}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - pressure (float) – light (in lux)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Linear acceleration¶
-
POST
/android/sensors/linear_acc/{avm_id}
¶ Example request:
$ POST /android/sensors/linear_acc/jHLGWPeRSVyVzyCpWRsEjg \ '{"x": 0, "y": 9.776, "z": 0.813}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - x (float) – linear acceleration vector x (in m/s²)
- y (float) – linear acceleration vector y (in m/s²)
- z (float) – linear acceleration vector z (in m/s²)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Magnetometer¶
-
POST
/android/sensors/magnetometer/{avm_id}
¶ Example request:
$ POST /android/sensors/magnetometer/jHLGWPeRSVyVzyCpWRsEjg \ '{"x": 0, "y": 9.776, "z": 0.813}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - x (float) – magnetometer vector x (in µT)
- y (float) – magnetometer vector y (in µT)
- z (float) – magnetometer vector z (in µT)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Orientation¶
-
POST
/android/sensors/orientation/{avm_id}
¶ Example request:
$ POST /android/sensors/orientation/jHLGWPeRSVyVzyCpWRsEjg \ '{"azimuth": 0, "pitch": 9.776, "roll": 0.813}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - azimuth (float) – device azimuth in degrees
- pitch (float) – device pitch in degrees
- roll (float) – device roll in degrees
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Pressure¶
-
POST
/android/sensors/pressure/{avm_id}
¶ Example request:
$ POST /android/sensors/pressure/jHLGWPeRSVyVzyCpWRsEjg '{"pressure": 100}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - pressure (float) – pressure in hPa
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Proximity¶
-
POST
/android/sensors/proximity/{avm_id}
¶ Example request:
$ POST /android/sensors/proximity/jHLGWPeRSVyVzyCpWRsEjg '{"distance": 50}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - proximity (float) – proximity in cm
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Relative Humidity¶
-
POST
/android/sensors/relative_humidity/{avm_id}
¶ Example request:
$ POST /android/sensors/relative_humidity/jHLGWPeRSVyVzyCpWRsEjg \ '{"relative_humidity": 50}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - relative_humidity (float) – relative humidity in %
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Rotation vector¶
-
POST
/android/sensors/rotation_vector/{avm_id}
¶ Example request:
$ POST /android/sensors/rotation_vector/jHLGWPeRSVyVzyCpWRsEjg \ '{"x": 0, "y": 9.776, "z": 0.813, "angle": 12.783, "accuracy": 50}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - x (float) – rotation vector x
- y (float) – rotation vector y
- z (float) – rotation vector z
- angle (float) – rotation angle
- accuracy (float) – estimated accuracy (in radians)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Temperature¶
-
POST
/android/sensors/temperature/{avm_id}
¶ Example request:
$ POST /android/sensors/temperature/jHLGWPeRSVyVzyCpWRsEjg '{"temperature": 18}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - temperature – temperature in celsius degrees
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)
Recording¶
-
POST
/android/sensors/recording/{avm_id}
¶ Example request:
$ POST /android/sensors/recording/jHLGWPeRSVyVzyCpWRsEjg \ '{"filename":"recording.avi","start":"1"}' -i
Parameters: - avm_id – the virtual machine to which the data will be sent
JSON Parameters: - filename (string) – the filename to hold the video recording
- start (int) – whether to start or stop the recording (1 to start, 0 to stop)
Status Codes: - 204 No Content – the data has been sent
- 400 Bad Request – the data is not well formed (see response content)