Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

note-repl

An interactive JSON REPL for the Notecard.

note-repl reads JSON request objects from stdin (one per line), sends each to the Notecard using note-c, and prints the response. It is useful for:

  • Exploring the Notecard API interactively
  • Scripting sequences of requests via shell pipes
  • Debugging and troubleshooting Notecard connectivity

Usage

./note-repl [options]

  Transport (one required):
    --serial <port>   Serial port (e.g. /dev/ttyUSB0)
    --i2c   <device>  I2C bus device (e.g. /dev/i2c-1)

  Options:
    --baud  <rate>    Baud rate for serial (default: 9600)
    --addr  <addr>    I2C address in decimal (default: 23 = 0x17)
    --help            Show this message

  Send JSON requests via stdin, one per line. Press Ctrl-D to quit.

Interactive Session

$ ./build/examples/note-repl/note-repl --serial /dev/ttyUSB0
Connected via serial: /dev/ttyUSB0 @ 9600 baud
note-repl ready. Type JSON requests, one per line (Ctrl-D to quit).

> {"req":"card.version"}
{"body":{"org":"Blues Inc.","product":"Notecard","version":"notecard-9.2.1","sku":"NOTE-WBEX","description":"Notecard Cellular"},"version":"notecard-9.2.1.16977408"}

> {"req":"card.status"}
{"connected":true,"status":"{connected}","storage":0,"time":1741200000,"usb":true,"cell":false,"sync":false,"inbound":0,"outbound":0}

> {"req":"hub.status"}
{"connected":true,"status":"connected"}

> {"req":"note.add","file":"data.qo","body":{"temperature":22.5},"sync":true}
{}

> ^D

Scripted Usage

You can pipe a sequence of requests from a file or heredoc:

./build/examples/note-repl/note-repl --serial /dev/ttyUSB0 <<'EOF'
{"req":"card.version"}
{"req":"card.status"}
{"req":"hub.status"}
EOF

Or from a script:

echo '{"req":"card.temp"}' | \
    ./build/examples/note-repl/note-repl --serial /dev/ttyUSB0