Skip to content

kapslap/g2bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

G2Bridge

OpenClaw → Even Realities G2 smart glasses bridge.

Expo/React Native iOS app that receives messages from OpenClaw (via Telegram webhook on clawdbot) and pushes them to Even G2 glasses over BLE using the reverse-engineered protocol. Also supports voice recording, transcription, and sending messages back to Telegram.

Architecture

┌──────────────┐  Telegram   ┌──────────────┐  WebSocket   ┌──────────────┐  BLE   ┌──────────┐
│  Harbinger   │ ──────────► │  clawdbot    │ ───────────► │  G2Bridge    │ ──────►│  Even G2 │
│  (OpenClaw)  │             │  VPS bridge  │              │  iOS App     │        │  Glasses │
└──────────────┘             └──────────────┘              └──────────────┘        └──────────┘
                              100.77.111.100                iPhone BLE
                                    ▲                            │
                                    │         Voice msg          │
                                    └────────────────────────────┘
                                     POST /api/g2/transcribe
                                     POST /api/g2/telegram

Gestures

Gesture Source Action
Long press G2 touchpad / R1 Ring Toggle display on/off (wake/sleep)
Double tap G2 touchpad / R1 Ring / App button Start audio recording
Double tap (while recording) G2 touchpad / R1 Ring / App button Stop recording → transcribe → send to Telegram

How Gestures Work

The app uses a hybrid gesture system:

  1. BLE notifications — All notifications from the G2 glasses on the CHAR_NOTIFY characteristic are passed through a gesture classifier. Known patterns are mapped to actions; unknown patterns are logged for future reverse-engineering.
  2. On-screen buttons — The app has a large mic button that mirrors the double-tap behavior (tap to start recording, tap again to stop and send).
  3. Display wake toggle — A switch on the main screen sends wake/sleep packets to the G2 display.

Note: The G2 touchpad gesture BLE notification format isn't fully reverse-engineered yet. The classifier includes educated guesses based on the protocol structure. All unknown notifications are logged so we can decode new gesture patterns over time.

Components

/app — Expo/React Native iOS app

  • BLE connection to G2 glasses (react-native-ble-plx)
  • WebSocket client to receive messages from bridge server
  • Teleprompter protocol for display rendering
  • Audio recording (expo-av) with transcription
  • Haptic feedback (expo-haptics) on gestures
  • Gesture detection from BLE notifications
  • Background BLE mode

/server — Bridge server (runs on clawdbot)

  • Express server with WebSocket
  • Receives webhook POSTs from OpenClaw
  • Pushes messages to connected iOS app clients
  • Audio transcription endpoint (Whisper-ready)
  • Telegram send endpoint

/protocol — G2 BLE protocol (TypeScript)

  • Ported from i-soxi/even-g2-protocol
  • CRC-16/CCITT, varint encoding, packet builder
  • Auth handshake, teleprompter service, display config
  • Display wake/sleep commands

Quick Start

Server (on clawdbot)

cd server
npm install
node index.js  # Runs on port 3847

iOS App (on your Mac)

cd app
npm install
npx expo prebuild --platform ios
npx expo run:ios  # Requires dev build (no Expo Go — BLE needs native modules)

EAS Build (remote)

cd app
npx eas build --profile development --platform ios

Server Endpoints

Method Path Description
POST /api/g2/push Receive message from OpenClaw webhook
POST /api/g2/transcribe Upload audio file for Whisper transcription
POST /api/g2/telegram Send text to Telegram channel
GET /api/g2/health Health check (clients, uptime)
GET /api/g2/latest Poll latest message
GET /api/g2/history Message history
WS /ws WebSocket for real-time push to iOS app

Environment Variables (Server)

Variable Required Description
PORT No Server port (default: 3847)
G2_AUTH_TOKEN No Shared secret for webhook auth
OPENAI_API_KEY No OpenAI API key for Whisper transcription
TELEGRAM_BOT_TOKEN No Telegram bot token for sending messages
TELEGRAM_CHAT_ID No Telegram chat ID to send messages to

Protocol Reference

  • BLE Service UUID: 00002760-08c2-11e1-9073-0e8ac72e0000
  • Write Characteristic: ...5401
  • Notify Characteristic: ...5402
  • Display: 25 chars × 10 lines per page, min 14 pages
  • Auth: 7-packet handshake, no PIN required
  • Display Wake: service 0x04-20, payload 0x08 0x01
  • Display Sleep: service 0x04-20, payload 0x08 0x00

TODO

  • Wire up Whisper API on server (uncomment in index.js, set OPENAI_API_KEY)
  • Wire up Telegram bot API on server (uncomment in index.js, set tokens)
  • Decode more G2 BLE gesture notification patterns from logged data
  • Add R1 ring gesture support (separate BLE connection)
  • Background recording support
  • Push notifications for urgent messages

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors