Streambox The VR Audio Proxy in a box. The Big Picture The Streambox interacts with VR Site in 2 phases. Phase 1: Knocking & Registering (v…
Streambox The VR Audio Proxy in a box. The Big Picture The Streambox interacts with VR Site in 2 phases. Phase 1: Knocking & Registering (v…
The VR Audio Proxy in a box.
The Streambox interacts with VR Site in 2 phases.
Default Endpoint: https://voicerepublic.com/api/devices
GET /:identifier
:identifier is a unique string (the streambox uses the cpu serial){
loglevel: 1,
endpoint: "https://voicerepublic.com/api/devices"
}POST /
with payload (example)
{
identifier: "00000000000000000768172641827",
type: "Streambox",
subtype: "v4"
}identifier is the unique string used during knockingtype is a string naming the clientsubtype is a string (could for example be a build number){
name: "Nietzsche",
state: "idle",
public_ip_address: "1.2.3.4",
report_interval: 30,
heartbeat_interval: 5,
faye_url: "https://voicerepublic.com:9292/faye",
faye_secret: "12345678987654321",
pairing_token: "1234"
}name is the name of the device as given by the user, should be displayedstate is the state of the device, states is either pairing or idlepublic_ip_address the visible public ip (gateway) of the devicereport_interval number of seconds between reportsheartbeat_interval number of seconds between heartbeatsfaye_url the url to the faye serverfaye_secret the faye secretpairing_token a token to identify the device during pairing (coming soon)NOTE: Faye setup is subject to change, for security reasons.
Using the faye details acquired upon registering, the device has to subscribe to the following channel:
/device/:identifierMost messages follow the following pattern (but some don't):
event describes the type of messageevent holds further detailsstart_stream - starts the stream, details in key icecaststop_stream - stops the streamrestart_stream - stops and starts with previous parameterseval - evals the code provided in evalexit - exits the ruby process (will be restarted)shutdown - shuts the box downreboot - reboots the boxprint - print (only in loglevel debug)heartbeat (deprecated)report (deprecated)error - ?handshake - ?start_stream icecast example:
{
event: "start_stream",
icecast: {
public_ip_address: "1.2.3.4",
source_password: "kahsdkjs",
mount_point: "1732673-1298736821-19283792-1263",
port: 80
}
}The box publishes a heartbeat to channel
/heartbeatwith payload (example)
{
identifier: "00000000000087434573245",
interval: 5
}with pauses of n seconds in between heartbeats, where n is given by
heartbeat_interval during registering.
The box publishes reports to channel
/reportwith payload (example)
{
identifier: "000000000082734873468732",
interval: 30,
report: {
}
}with pauses of n seconds, where n is given by report_interval during registering.
All instructions are based on raspbian jessie lite.
By default, raspbian will automatically resize the partitions on startup. Since we want to create an image with as little overhead as possible, this must be deactivated! See the next section for instructions how to do this.
E.g.
dd bs=4M if=2016-03-18-raspbian-jessie.img of=/dev/mmcblk0dd bs=4m if=2016-03-18-raspbian-jessie.img of=/dev/rdisk2m in bs=4m needs to be lowercase in OSXThis will take a while. (It takes almost 5 minutes on my machine.) You
can use time to find out how long exactly. Or append && aplay to get an alert when done.
Do this before writing the image to the sd card!
cmdline.txtquiet init=/usr/lib/raspi-config/init_resize.shFind the PI in you local network. Connect a display the pi will print
it's ip address during boot. Otherwise nmap or nc are helpful to
poke around.
Ssh into the pi with forward agent -A.
Username pi, password raspberry.
sudo -i SSH_AUTH_SOCK="$SSH_AUTH_SOCK"We need to set SSH_AUTH_SOCK so that our forwarded ssh agent is available in the new environment created by sudo.
…To
/boot/cmdline.txtadd
consoleblank=0 quietIn
/boot/config.txtuncomment the line
hdmi_force_hotplug=1The type of the box is always 'Streambox'.
The subtype is stored in /home/pi/subtype.
If you make a change to the box setup, which is not covered by the git repo, please update the subtype file and the corresponding list of known usb devices.
echo -n "v0.3prototype" > /home/pi/subtype
sudo bash -c "lsusb > /home/pi/streambox/lsusb/$(cat /home/pi/subtype)"sudo raspi-config toaeg9ethoh0thiojiIf the previous step didn't cause a reboot, reboot!
rebootSend commands to box from rails console, e.g.
device = '/device/000000008ff66473'
Faye.publish_to device, event: 'eval', eval: '21*2'
Faye.publish_to device, event: 'exit'
Faye.publish_to device, event: 'reboot'
Faye.publish_to device, event: 'shutdown'
Faye.publish_to device, event: 'start_stream', icecast: {...}
Faye.publish_to device, event: 'stop_stream'sudo killall ruby(cd streambox && git pull) && sudo rebootdd if=/dev/mmcblk00 of=2016-06-14_streambox_small.img bs=32M iflag=fullblock count=42 status=progressThis ensures that only 42 * 32 MB are written, which is about 1.4 GB. This is important, because otherwise the image will have the full size of the SD card it is copied from.
For OSX specific command, see Dependencies.
dd bs=4M of=/dev/mmcblk0 if=streambox_v0-3prototype.imgFor OSX specific command, see Dependencies.
Create a deploy key
ssh-keygen -t rsa -C boxed keyAdd the public key to this repo on GitLab.
Check both keys (public and private) into this repo.
sudo dpkg --configure -a sometimes helps and seems idempotentsudo bing -e 200 localhost voicerepublic.combing from behind a FW?wget -c https://github.com/raboof/nethogs/archive/v0.8.5.tar.gz
tar xf v0.8.5.tar.gz
cd ./nethogs-0.8.5/
sudo apt-get -y install libncurses5-dev libpcap-dev
make && sudo make install
nethogs -V
sudo nethogsNo open issues yet, or sync has not completed.