| Overview | 
 | -------- | 
 | The wrapper implements OS dependent services for libweave | 
 |  | 
 | Building | 
 | -------- | 
 |   - prepare environment | 
 |         examples/prerequisites.sh | 
 |   - build daemon | 
 |         examples/build.sh | 
 |   - binaries for daemon is at | 
 |         out/Debug/weave_daemon | 
 |  | 
 | Prepare Host OS | 
 | --------------- | 
 | enable user-service-publishing in avahi daemon | 
 |     file:    /etc/avahi/avahi-daemon.conf | 
 |     check:   disable-user-service-publishing=no | 
 |     restart: sudo service avahi-daemon restart | 
 |  | 
 | Acquire Registration Ticket | 
 | --------------------------- | 
 | Goto https://developers.google.com/oauthplayground/ | 
 |   - "Step 1", paste to "Authorize APIs" with | 
 |           https://www.googleapis.com/auth/clouddevices | 
 |         click "Authorize APIs", then "Allow" to get an | 
 |         "authorization code" | 
 |   - "Step 2", "Exchange authorization code for tokens" | 
 |   - "Step 3", obtain a registration ticket for your new weave device | 
 |          HTTP Method:  POST | 
 |          Request URI:  https://www.googleapis.com/clouddevices/v1/registrationTickets | 
 |          Enter request body: | 
 |             { | 
 |               "userEmail": "me" | 
 |             } | 
 |          then "Send the request", a ticket id will be returned in | 
 |             { | 
 |               "userEmail": "user@google.com", | 
 |               "kind": "clouddevices#registrationTicket", | 
 |               "expirationTimeMs": "1443204934855", | 
 |               "deviceId": "0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d", | 
 |               "creationTimeMs": "1443204694855", | 
 |               "id": "93019287-6b26-04a0-22ee-d55ad23a4226" | 
 |             } | 
 |     Note: the ticket "id" is not used within 240 sec, it will be expired. | 
 |  | 
 | Register device to cloud | 
 | ------------------------ | 
 |   - copy the ticket "id" generated above | 
 |         93019287-6b26-04a0-22ee-d55ad23a4226 | 
 |   - go to terminal, register and start the daemon with | 
 |  | 
 |         sudo out/Debug/weave_daemon --registration_ticket=93019287-6b26-04a0-22ee-d55ad23a4226 | 
 |  | 
 |         you should see something like: | 
 |           Publishing service | 
 |           Saving settings to /var/lib/weave/weave_settings.json | 
 |  | 
 |        note: in second and future runs, --registration_ticket | 
 |              options is not necessary anymore | 
 |  | 
 |   - get your device id with | 
 |           sudo cat /var/lib/weave/weave_settings.json | 
 |        you should see | 
 |             ... | 
 |             "device_id": 0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d | 
 |             ... | 
 |  | 
 |        this device_id shall be used for future communication | 
 |        with your device. it does not expire and no need to | 
 |        register. | 
 |  | 
 |   - verify device is up with Weave Device Manager at | 
 |         android: https://play.google.com/apps/testing/com.google.android.apps.weave.management | 
 |         chrome: https://chrome.google.com/webstore/detail/weave-device-manager/pcdgflbjckpjmlofgopidgdfonmnodfm | 
 |         [need your whitelisted EAP account] | 
 |  | 
 | Send Command to the Daemon | 
 | -------------------------- | 
 |   - go to the oauthplayground used for registration ticket command | 
 |      in "Step 3", send base.identify with | 
 |         HTTP Method: POST | 
 |         Request URI: https://www.googleapis.com/clouddevices/v1/commands | 
 |         Enter request body: | 
 |         { | 
 |           "deviceId": "0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d", | 
 |           "name": "_sample._hello", | 
 |           "parameters": { "_name": "cloud user" } | 
 |         } | 
 |    "Send the request", you command will be "queued" as its "state" | 
 |  | 
 |   - verify the command execution with weave daemon | 
 |        in terminal running the daemon, observe something similar to | 
 |          New command '_sample._hello' arrived, ... | 
 |          received command: _sample._hello | 
 |          _sample._hello command: finished | 
 |   - verify the command history with oauthplayground | 
 |        Similar to "Acquire Registration Ticket" section in this document, | 
 |        except in "step 3", do: | 
 |  | 
 |        HTTP Method:  GET    [not POST anymore] | 
 |        Request URI:  https://www.googleapis.com/clouddevices/v1/commands?deviceId=0f8a5ff5-1ef0-ec39-f9d8-66d1caeb9e3d | 
 |  | 
 |        "Send the request", you get all of the commands executed on your | 
 |        device, find something like | 
 |           "kind": "clouddevices#command", | 
 |           "name": "_sample._hello", | 
 |           "results": { | 
 |             "_reply": "Hello cloud user" | 
 |           }, | 
 |           ... | 
 |  |