Code Monkey home page Code Monkey logo

fxos-device-service's Introduction

fxos-device-service

Build Status npm version

A RESTful web service that exposes interactions with a connected Firefox OS device

API Methods

GET /

Status message that shows whether the service is running.

POST /connections/:port

Open a tcp connection to the parameter port. Returns a port on the host machine that is proxied to that device port.

DELETE /connections/:port

Close the device tcp connection previously opened on the parameter port.

GET /crashes

List ids of crash reports on device.

GET /crashes/:id

Download the crash dump with the parameter crash id.

GET /devices

List ids of adb-attached devices.

GET /devices/:id

Fetch details about the device whose adb id is the parameter id.

GET /device

Fetch details about a device. The service will look at the request headers (particularly X-Session-Id or X-Android-Serial) to figure out which device to report about.

POST /events

Trigger a series of sequential low-level touch interactions. The client is expected to write a JSON array of event objects for which to sequentially execute. See the syntax for POST /events/:event for event object schema.

POST /events/:event

Trigger a low-level touch-related interaction. The client is expected to write a JSON object with event-related properties which control the trigger details.

Valid event types and their JSON properties:

  • doubletap
    • x, X-axis coordinate
    • y, Y-axis coordinate
  • drag
    • x, X-axis coordinate to start drag
    • y, Y-axis coordinate to start drag
    • endX, X-axis coordinate to end drag
    • endY, Y-axis coordinate to end drag
    • duration, time in milliseconds for drag to elapse
  • keydown
    • code, keycode for the key press
  • keyup
    • code, keycode for the key release
  • reset, needs no parameters
  • sleep
    • duration, time in milliseconds to wait before next event invocation. Useful when triggering many events in a single request.
  • tap
    • x, X-axis coordinate
    • y, Y-axis coordinate

Example:

curl \
  -H 'Content-Type: application/json' \
  -X POST \
  'http://localhost:8080/events/tap' \
  --data-binary '{"x":100,"y":200}'

GET /files?filepath=<filepath>

Download a file from device. Use the filepath query parameter to specify the location of the file to download.

PUT /files?filepath=<filepath>

Upload a file to device. Use the filepath query parameter to specify the path destination of the uploaded file. The uploaded file should sent via multipart/form-data. A file permissions mode may also be set during upload.

Examples:

# Will upload myfile.txt to /data/local/myfile.txt
curl \
  -X PUT
  -F '[email protected]'
  'http://localhost:8080/files?filepath=/data/local/myfile.txt'
# Will upload image.jpg to /data/local/image.jpg with 777 permissions
curl \
  -X PUT
  -F '[email protected]'
  -F 'mode=777'
  'http://localhost:8080/files?filepath=/data/local/image.jpg'
# Will upload script.sh to /data/local/script.sh with executable permissions
curl \
  -X PUT
  -F '[email protected]'
  -F 'mode=+x'
  'http://localhost:8080/files?filepath=/data/local/script.sh'

GET /logs

Pipe logs from logcat to the connected client.

POST /logs

Write a log to the adb-connected device. The client is expected to write a JSON object in the request body with the following fields:

  • message, required
  • priority, optional, defaults to i
  • tag, optional, defaults to DeviceService

DELETE /logs

Clear all logcat logs on adb-connected device.

DELETE /processes/:pid

Delete the process given by pid parameter.

GET /properties

Retrieve a JSON object of all the device properties and their associates values.

GET /properties/:id

Retrieve the value of a device property specified by the :id url parameter.

POST /properties

Set the values of a collection device properties. The client is expected to write a JSON object which contains a dictionary of property names to values.

POST /restart?hard=(true|false|0|1)

Restarts b2g process running on device. If the url parameter hard is true or 1, then the device will be restarted instead.

Request headers

X-Session-Id

We store a map from session ids to sessions on the server. The X-Session-Id request header allows you to make a request using details from an existing session which are stored on the server. Every request response comes with an X-Session-Id header.

X-Android-Serial

The X-Android-Serial header allows you to specify that a certain adb device id should be used when multiple devices are connected to the host machine.

X-Remote-Host

The X-Remote-Host header specifies a remote host for any commands issued via adb to use during this request.

X-Remote-Port

The X-Remote-Port header specifies a device port for any commands issued via adb to use during this request.

fxos-device-service's People

Contributors

eliperelman avatar lambdabaa avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.