Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Hexxeh/libpebble
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: pebble/libpebble
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
Loading
Showing with 6,557 additions and 1,446 deletions.
  1. +5 −1 .gitignore
  2. +6 −125 README.md
  3. +0 −257 p.py
  4. +159 −0 pebble.py
  5. +551 −0 pebble/LibPebblesCommand.py
  6. +118 −0 pebble/PblAccount.py
  7. +301 −0 pebble/PblBuildCommand.py
  8. +37 −0 pebble/PblCommand.py
  9. +82 −0 pebble/PblProject.py
  10. +60 −0 pebble/PblProjectConverter.py
  11. +270 −0 pebble/PblProjectCreator.py
  12. +225 −0 pebble/PebbleEmulator.py
  13. +7 −1 pebble/__init__.py
  14. +150 −0 pebble/analytics.py
  15. +0 −1,031 pebble/pebble.py
  16. +6 −0 pebble/python
  17. +28 −0 pebblecomm/AppStore.py
  18. +8 −9 {pebble → pebblecomm}/LightBluePebble.py
  19. +31 −0 pebblecomm/PebbleUtil.py
  20. +61 −0 pebblecomm/ProxyWebSocketPebble.py
  21. +142 −0 pebblecomm/QemuPebble.py
  22. +192 −0 pebblecomm/WebSocketPebble.py
  23. +3 −0 pebblecomm/__init__.py
  24. +2,650 −0 pebblecomm/pebble.py
  25. +103 −0 pebblecomm/speex.py
  26. 0 {pebble → pebblecomm}/stm32_crc.py
  27. +0 −21 repl.py
  28. +7 −1 requirements.txt
  29. +34 −0 run_tests.py
  30. 0 test/__init__.py
  31. 0 test/unit/__init__.py
  32. +17 −0 test/unit/analytics_data/good_c_app/appinfo.json
  33. +60 −0 test/unit/analytics_data/good_c_app/src/hello_world.c
  34. +48 −0 test/unit/analytics_data/good_c_app/src/sub_dir/other_module.c
  35. +24 −0 test/unit/analytics_data/good_c_app/wscript
  36. +55 −0 test/unit/analytics_data/good_js_app/appinfo.json
  37. BIN test/unit/analytics_data/good_js_app/resources/fonts/unicons_30.ttf
  38. BIN test/unit/analytics_data/good_js_app/resources/img/cloud.png
  39. BIN test/unit/analytics_data/good_js_app/resources/img/rain.png
  40. BIN test/unit/analytics_data/good_js_app/resources/img/snow.png
  41. BIN test/unit/analytics_data/good_js_app/resources/img/sun.png
  42. +107 −0 test/unit/analytics_data/good_js_app/src/js/pebble-js-app.js
  43. +136 −0 test/unit/analytics_data/good_js_app/src/weather.c
  44. +24 −0 test/unit/analytics_data/good_js_app/wscript
  45. +17 −0 test/unit/analytics_data/outdated_project/appinfo.json
  46. +60 −0 test/unit/analytics_data/outdated_project/resources/src/resource_map.json
  47. +60 −0 test/unit/analytics_data/outdated_project/src/hello_world.c
  48. +24 −0 test/unit/analytics_data/outdated_project/wscript
  49. +17 −0 test/unit/analytics_data/too_big/appinfo.json
  50. +64 −0 test/unit/analytics_data/too_big/src/hello_world.c
  51. +24 −0 test/unit/analytics_data/too_big/wscript
  52. +11 −0 test/unit/projects/needs_convert/resources/src/resource_map.json
  53. +163 −0 test/unit/projects/needs_convert/src/simple_analog.c
  54. +105 −0 test/unit/projects/needs_convert/src/simple_analog.h
  55. +43 −0 test/unit/projects/with spaces/appinfo.json
  56. BIN test/unit/projects/with spaces/resources/fonts/futura.ttf
  57. BIN test/unit/projects/with spaces/resources/images/no_litter_crop.png
  58. BIN test/unit/projects/with spaces/resources/images/no_litter_crop1.png
  59. BIN test/unit/projects/with spaces/resources/images/no_litter_crop2.png
  60. BIN test/unit/projects/with spaces/resources/raw/subdir/blob.bin
  61. +55 −0 test/unit/projects/with spaces/src/feature_draw_bitmap.c
  62. +24 −0 test/unit/projects/with spaces/wscript
  63. +183 −0 test/unit/test_projects.py
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ dist
build
eggs
parts
bin
var
sdist
develop-eggs
@@ -34,3 +33,8 @@ nosetests.xml
.project
.pydevproject
.idea
.DS_Store

# virtualenv
.env
env
131 changes: 6 additions & 125 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,10 @@
libpebble
=========
Interact with your Pebble from OSX, Ubuntu or Debian operating systems.
libpebble and pb-sdk
-====================

## Warning and Complications
Those tools that are now part of Pebble SDK are based on the original libpebble by Hexxeh (Liam McLoughlin).

* Supported OSes are `OSX 10.8`, `Ubuntu`, `Debian`
* OSes which can utilize a faster Bluetooth library, Lightblue-0.4, are `OSX 10.8` and `Ubuntu`
* Detailed Lightblue-0.4 installation instructions for earlier version of OSX (10.6) and other OSes can be found [here](http://lightblue.sourceforge.net/#downloads)
Original project: https://github.com/Hexxeh/libpebble

This version of libpebble can talk to the Pebble watch through your smartphone using websockets instead of directly to the watch using Bluetooth. As of SDK 2.0, this is the recommended way. However, it is still possible to establish a direct Bluetooth connection to the watch with LightBlue.

##1. Install Dependencies

All supported OSes will require `python 2.7` to operate libpebble. It can be installed [here](http://www.python.org/download/releases/2.7/)
* `Pyserial`will also be required, is can be installed via [pip](https://pypi.python.org/pypi/pip)

###a. OSX Additional Dependencies

Installing Lightblue-0.4 in OSX will require the following be installed:
* `PyObjC` which can be installed via [pip](https://pypi.python.org/pypi/pip)
* `Xcode 2.1 or later` to build LightAquaBlue framework

###b. Ubuntu Additional Dependencies

Installing Lightblue-0.4 in Ubuntu requires some extra dependencies be installed via `apt-get install`:
* `python-dev`
* `libopenobex1-dev`
* `python-tk` if you wish to use the GUI selection tool

###c. Debian Additional Dependencies

Support for lightblue is untested in Debian, however the following should be installed/completed for use with PySerial:
* Install rfcomm `sudo apt-get install rfcomm`
* Bind the device `sudo rfcomm bind 0 PEBBLE_BLUETOOTH_ADDRESS 1`
* Make the following code change to `pebble/pebble.py`:
Change:

self._ser = serial.Serial("/dev/tty.Pebble"+id+"-SerialPortSe", 115200, timeout=2)

to:

self._ser = serial.Serial("/dev/rfcomm0", 115200, timeout=2)

* Note that you may have to run libpebble as root with `sudo python pebble.py` in Debian


##2. Install Libpebble and Lightblue

* To install libpebble, clone the current libpebble with lightblue support from `git@github.com:pebble/libpebble.git` to a location of your choosing
* To install lightblue clone `lightblue-0.4` from `https://github.com/pebble/lightblue-0.4` and then:
* `cd lightblue-0.4`
* `sudo python setup.py install`


##3. Testing the Connection
Note: you should have your bluetooth module enabled before continuing

###a. OSX
When using libpebble on OSX, it is recommended that `--lightblue` be utilized.

#####Using libpebble with --lightblue on OSX
* First install the OSX dependencies, general dependencies and lightblue
* From the `libpebble` folder, execute the following: `./p.py --lightblue --pair get_time`
* Note that if no `--pebble_id` is specified before the command, you are provided with a GUI selection tool.
* Note that if a MAC address is supplied, initialization time is reduced.
* For example: `./p.py --pebble_id 00:11:22:33:44:55:66 --lightblue get_time`
where `00:11:22:33:44:55:66` is the Pebble's MAC Address, viewable on the Pebble from `settings`-->`about`
* You can obtain your pebble's MAC address after a successful connection in the libpebble stdout debug logs
* The `--pebble_id` can also be the 4 letter friendly name of your pebble but this will require that the Pebble is broadcasting.
* It is also possible to set the PEBBLE_ID environment variable as well:

export PEBBLE_ID="00:11:22:33:44:55:66"
./p.py --lightblue get_time

#####Using libpebble without --lightblue on OSX (MAY CAUSE KERNEL PANICS)

* Pair your Pebble to your computer and make sure it's setup as a serial port. For example it could be exposed as `/dev/tty.Pebble123A-SerialPortSe`. You can accomplish this by using OSX's pairing utility in `System Preferences` --> `Bluetooth` -> `+` --> selecting your pebble `Pebble XXXX` then confirming the pairing code on the Pebble.
* Once you're paired and the serial port is setup, you can execute commands without the `--lightblue` flag, just ensure that the `--pebble_id` is the 4 letter friendly name of your Pebble, `123A` for example.
* A command to get the time might be: `./p.py --pebble_id 123A get_time`

### b. Ubuntu

_Automated pairing via `--pair` is not currently supported in Ubuntu_

* First install the Ubuntu dependencies, general dependencies and lightblue
* In Ubuntu's `Menu`-->`Settings`-->`Connectivity`-->`Bluetooth` dialog, pair with your Pebble
* From the `libpebble` folder, execute the following: `./p.py --lightblue get_time`
* Note that if no `--pebble_id` is specified before the command, you are provided with a GUI selection tool.
* For example: `./p.py --pebble_id 00:11:22:33:44:55:66 --lightblue get_time`
* The `--pebble_id` can also be the 4 letter friendly name of your pebble but this require that the Pebble is broadcasting.

## Applications
* Note that applications each have a unique UUID which is used to launch on install/re-install, it should be visible in the source for your application.
* Once an application is installed or re-installed it will be launched automatically. Disable this with `--nolaunch`
* for example `./p.py --pebble_id 00:11:22:33:44:55:66 --lightblue reinstall brains.pbw --nolaunch`

#####Installing:
* From your libpebble directory, execute `p.py` with the argument `load <path-to-valid-app>`
* for example: `./p.py --pebble_id 00:11:22:33:44:55:66 --lightblue load brains.pbw`

#####Re-installing
* To re-install an application, execute `p.py` with the argument `reinstall <path-to-valid-app>`. This will attempt to remove the application by its UUID or, if that fails, the name of the application before installing it once more.
* for example: `./p.py --pebble_id 00:11:22:33:44:55:66 --lightblue reinstall brains.pbw`

Functionality
-------------

The following are currently supported:

* Sending email, sms and ping notifications
* Installing, reinstalling and uninstalling applications
* Installing firmwares
* Launching applications by UUID
* Sending application messages
* Resetting device
* Setting/getting time
* Sending notifications
* Setting the currently playing track
* Getting the installed firmware version
* Getting and setting the pebble's time

REPL
----

A basic REPL is available, it is best used with ipython:

`sudo ipython repl.py`

The variable `pebble` refers to the watch connection. You can for example perform `pebble.get_time()` to get the time of the watch
Refer to Pebble SDK Documentation for help on using pb-sdk.py.
Loading