A lot of my apps for pebble have the same workflow:
- Send data from the pc to the pebble app.
- Store the data on the watch and close the connection.
- At a later stage, display the data and gather feedback.
- At a later stage, send the data back to the pc.
This is a learning project in order to set this process up in the most reliable way, so that it can be used as a template for other apps.
Currently:
- The data is read from csv in form of a string and a time values and send via a Python script.
- The demo app receives them via AppMessage, stores them.
- It can display the data.
- It updates the time and sends it back via Data-Logging.
- The data is received and stored to csv via a Python script.
-
Install Pebble SDK (see (jim108dev/lessons-learned)).
-
Install OS dependencies
apt-get install python-enum34 python-six python-serial
- Install repository 's software
git clone https://github.com/jim108dev/pebble-pc-template.git
# Because libpebble2 does not work with python 3.7 a python 2.7 virtual environment is created.
# ([Errno 2] No such file or directory: '/dev/rfcomm0 ; bluetooth transport')
cd pebble-pc-template/host_python
virtualenv --python=/usr/bin/python2.7 venv
bash
source venv/bin/activate
pip install -r requirements.txt
deactivate
- Run on the emulator
cd pebble_app
pebble build && pebble install --logs --emulator aplite
# second terminal
# Activate venv
cd host_python
./pebble_upload.py config_emu.ini
# Browse the emulator window
# Download the created data
./pebble_download.py config_emu.ini
- Run on the watch
cd pebble_app
pebble build && pebble install --serial /dev/rfcomm0
# second terminal
# Activate venv
cd host_python
./pebble_upload.py config_watch.ini
# Browse the emulator window
# Download the created data
./pebble_download.py config_watch.ini
- The config for VSCode is inside
pebble_app/.vscode
. In order to have IntelliSensepebble_app
must be added directly withAdd Folder to Workspace
.
Yes, the critical part is getting the port of the running emulator.
1 of 5 times the upload works.
This does not work with the watch because both connections use the same port. It is working with the emulator.
Because Data-Logging is used, it works every time.
I have used a field to store the maximum number of records. And I am storing the records with an offset of 10.
- The emulator does not show debug messages right away. Reproduce with:
pebble new-project pebble-test
cd pebble-test
pebble build && pebble install --logs --emulator aplite
#Installing app...
#App install succeeded.
# no message
#<-Left arrow key, right arrow key->
#[18:18:59] ocess_manager.c:417> Heap Usage for App <pebble-tes: Total Size <23044B> Used <340B> Still allocated <24B>
#[18:19:01] pebble-test.c:65> Done initializing, pushed window: 0x2001a618