ps2 / pod

Omnipod Simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pod

Fake pod implementation

This was forked to loopnlearn as part of the development for dash-pods with iOS.

  • The original 0pen-dash repository from which this was forked was removed by the owner.

Requirements:

  1. Version of iOS code that handles this - under development - not ready for others to use
  2. Raspberry pi with Bluetooth BLE (using a pi4 right now)
  3. The user must have sudo privilege on the pi
  4. Install the go language on your device (search internet for procedure)
  • You can build on pi directly or use cross-compiler and scp the executable

Build on the pi

Log on the pi and type the following commands, starting at {your_path}/pod:

go build
sudo setcap 'cap_net_raw,cap_net_admin=eip' ./pod

Run simulator on the pi

The simulator runs until

  • aborted with a control-C
  • pod is deactivated on the phone
  • quit out of phone app after establishing BLE connection

The simulator may error out unexpectedly. Just restart it and it should reconnect with the app (do not use the -fresh flag in this case.)

When in doubt, control-C and restart it.

To pair a new simulated dash pod:

./pod -fresh -q

Wait until getting this notification before attempting to pair with the app:

enabled notifications for CMD:
enabled notifications for DATA:
*** OK to send commands from the phone app ***

To restore communication with an existing simulated dash pod and wait for the messages shown above:

./pod -q

To change the reporting level, add one of these two flags:

  • -v to make reporting more verbose (Trace Level)
  • -q to make reporting less verbose (recommended)
  • no extra flag - medium verbose (Debug Level)

Note that quitting the app will cause the following message:

FATA[####] pkg bluetooth; ** disconnect:

Simple restore communication as stated above.

Original README.md

We maintained the original README file below. It may be helpful if someone plans to cross-compile the code and just transfer the executable.

The "scripts" folder contains bits and small pieces that I [original owner] used trying to figure out the protocol with data from logs.

How to build

go build

building for Raspberry Pi:

GOARCH=arm go build`

How to run

This was tested so far only on Linux. Before running, bring the BLE device down and stop bluetooth daemon

sudo hciconfig
sudo hciconfig hci0 down

sudo service bluetooth stop
sudo  systemctl  disable bluetooth

Before running, the executable must be granted capabilities(or run as root):

sudo setcap 'cap_net_raw,cap_net_admin=eip' ./pod

And then run

./pod -fresh

Flags

$ ./pod  --help
Usage of ./pod:
  -fresh
        start fresh. not activated, empty state
  -state string
        pod state (default "state.toml")

When running with -fresh, the state will be saved, so running it twice(first with -fresh, then without) should work.

How to build & run for Raspberry pi

Tested on Raspberry Pi 3B+ running Raspbian 10

GOARCH=arm go build;
ssh pi 'killall pod';
scp pod pi:~/  
ssh pi " sudo setcap 'cap_net_raw,cap_net_admin=eip' ./pod; ./pod"

About

Omnipod Simulator

License:GNU General Public License v3.0


Languages

Language:Go 81.5%Language:Python 18.5%