react-native-open-dash
v0.0.2
Published
React Native wrapper for open-dash-sdk
Maintainers
Readme
react-native-open-dash
Unofficial React Native Native Module for the Royal Enfield Tripper Dash K1G control protocol.
This package provides an Android native bridge to handle the raw UDP socket connections and Wi-Fi network specifier required to communicate with the Tripper Dash.
Note: This module currently supports Android. It utilizes
WifiNetworkSpecifier(for Android Q+) to programmatically bind your app to the dash's Wi-Fi network before opening the UDP sockets.
Installation
npm install react-native-open-dashUsage
This package wraps the underlying connection state machine. You can connect, disconnect, and listen for events from the dash.
import { NativeModules, DeviceEventEmitter } from 'react-native';
const { TripperDash } = NativeModules;
// Listen for state changes
DeviceEventEmitter.addListener('stateChange', (state) => {
console.log('Dash Connection State:', state);
});
// Listen for joystick/button events
DeviceEventEmitter.addListener('buttonEvent', (code) => {
console.log('Button pressed on dash:', code);
});
// Listen for errors
DeviceEventEmitter.addListener('error', (err) => {
console.error('Dash Error:', err);
});
async function connectToBike() {
try {
// The exact SSID of the Dash's Wi-Fi network
await TripperDash.connectToDash('RE_TRIPPER_1234');
console.log("Connected successfully!");
} catch (error) {
console.error("Connection failed", error);
}
}
function disconnectBike() {
TripperDash.disconnect();
}Authentication Note
Before you can successfully authenticate with real hardware, the DashAuth.kt file inside this library must be updated with a valid RSA Key Derivation implementation derived from a real packet capture, as the exact 128-byte ciphertext payload is not published publicly.
License
Apache-2.0
