meshtastic_radio
A Dart package for communicating with and configuring Meshtastic devices. This package provides a high-level API for device discovery, configuration, messaging, and more, making it easy to integrate Meshtastic radios into your Dart or Flutter applications.
Features
- Discover and connect to Meshtastic devices via Bluetooth
- Send and receive messages
- Configure device settings (network, power, LoRa, etc.)
- Protobuf-based communication for reliability and extensibility
- Cross-platform support (Dart & Flutter)
Getting Started
Installation
Add the following to your pubspec.yaml
:
dependencies:
meshtastic_radio: ^0.0.1
Then run:
dart pub get
Import
import 'package:meshtastic_radio/meshtastic_radio.dart';
Usage
Below is a simple example of how to discover and connect to a Meshtastic device:
import 'package:meshtastic_radio/meshtastic_radio.dart';
void main() async {
final radio = MeshtasticRadio();
// Discover devices
final devices = await radio.discoverDevices();
if (devices.isNotEmpty) {
// Connect to the first device
await radio.connect(devices.first);
// Send a message
await radio.sendMessage('Hello Meshtastic!');
// Listen for incoming messages
radio.onMessage.listen((msg) {
print('Received: $msg');
});
}
}
For more advanced usage and configuration, see the API documentation.
Architecture
meshtastic_radio/
│
├── lib/
│ ├── meshtastic_radio.dart # Public API
│ ├── src/
│ │ ├── ble/
│ │ │ ├── ble_manager.dart # Central BLE logic
│ │ │ ├── device_connector.dart # Scanning and connection
│ │ │ └── characteristic_handler.dart # Read/write/notify handler
│ │ ├── protocol/
│ │ │ ├── message_codec.dart # Encode/decode protobuf messages
│ │ │ └── message_types.dart # Dart classes for known message types
│ │ ├── models/
│ │ │ ├── meshtastic_device.dart # Device abstraction
│ │ │ └── ble_characteristics.dart # UUID constants
│ │ └── utils/
│ │ └── logger.dart # Internal logging helper
│
└── pubspec.yaml
Contributing
Contributions are welcome! Please open issues and pull requests on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Disclaimer
This package is not affiliated with or endorsed by the official Meshtastic project. Use at your own risk.