Scout-Ops-Android Developer Guide
This guide is intended for developers who want to understand, modify, or extend the Scout-Ops-Android application. It covers the technical architecture, development environment setup, and contribution guidelines.
Technical Architecture
Scout-Ops-Android is built using the Flutter framework for cross-platform mobile development. The application follows a modular architecture with several key components:
Core Components
-
Data Layer
- Uses Hive for local storage
- Models for match data, team data, and scouting templates
- Repository pattern for data access
-
UI Layer
- Material Design components
- Custom widgets for scouting interfaces
- Responsive layouts for different device sizes
-
Business Logic
- Service classes for data processing
- Bluetooth communication handlers
- QR code generation utilities
-
Integration Layer
- The Blue Alliance API client
- Bluetooth PAN connectivity
- CSV data export functionality
Development Environment Setup
Prerequisites
- Flutter SDK (latest stable version)
- Android Studio or Visual Studio Code
- Git
- Android device or emulator for testing
Setting Up the Development Environment
-
Clone the Repository
git clone https://github.com/feds201/Scout-Ops-Android.git cd Scout-Ops-Android
-
Install Dependencies
flutter pub get
-
Configure IDE
- For Android Studio: Open the project folder and ensure Flutter plugin is installed
- For VS Code: Install Flutter and Dart extensions
-
Run the Project
flutter run
Project Structure
lib/
├── api/ # API clients and services
├── models/ # Data models
├── repositories/ # Data access layer
├── screens/ # UI screens
│ ├── autonomous/ # Autonomous phase screens
│ ├── teleop/ # Teleop phase screens
│ ├── endgame/ # Endgame phase screens
│ └── settings/ # Settings screens
├── services/ # Business logic services
├── utils/ # Utility functions
├── widgets/ # Reusable UI components
└── main.dart # Application entry point
Key Features Implementation
Scouting Flow Implementation
The scouting flow is implemented as a series of pages managed by a PageView
widget:
// Example of page navigation controller
final PageController _pageController = PageController(initialPage: 0);
// Navigate to next phase
void goToNextPhase() {
_pageController.nextPage(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
}
Data Storage with Hive
Match data is stored using Hive boxes:
// Example of Hive data storage
@HiveType(typeId: 0)
class MatchData extends HiveObject {
@HiveField(0)
late String matchNumber;
@HiveField(1)
late String teamNumber;
@HiveField(2)
late String allianceColor;
// Other fields...
}
QR Code Generation
QR codes are generated using the qr_flutter
package:
// Example of QR code generation
QrImage(
data: jsonEncode(matchData.toJson()),
version: QrVersions.auto,
size: 200.0,
)
Bluetooth PAN Integration
Bluetooth communication uses the flutter_bluetooth_serial
package:
// Example of Bluetooth connection setup
BluetoothConnection connection = await BluetoothConnection.toAddress(address);
connection.input!.listen((data) {
// Process incoming data
});
// Send data
connection.output.add(Uint8List.fromList(utf8.encode(jsonEncode(matchData) + "\n")));
Extending the Application
Adding New Scouting Metrics
To add a new metric to track during matches:
- Add the field to the appropriate data model
- Update the Hive adapters
- Add UI components to collect the data
- Modify data export to include the new field
Example of adding a new field:
@HiveField(10)
late int defensiveActions;
// In the UI
NumberStepper(
initialValue: 0,
minValue: 0,
maxValue: 50,
onChanged: (value) => setState(() => matchData.defensiveActions = value),
)
Creating Custom Templates
The template system allows for customization of scouting forms:
@HiveType(typeId: 1)
class ScoutingTemplate extends HiveObject {
@HiveField(0)
late String templateName;
@HiveField(1)
late List<ScoutingField> fields;
}
@HiveType(typeId: 2)
class ScoutingField extends HiveObject {
@HiveField(0)
late String fieldName;
@HiveField(1)
late FieldType fieldType;
@HiveField(2)
late bool isRequired;
}
Testing the Application
Unit Tests
Write unit tests for business logic and data models:
void main() {
group('MatchData', () {
test('should convert to and from JSON correctly', () {
final matchData = MatchData()
..matchNumber = '1'
..teamNumber = '201'
..allianceColor = 'red';
final json = matchData.toJson();
final fromJson = MatchData.fromJson(json);
expect(fromJson.matchNumber, equals('1'));
expect(fromJson.teamNumber, equals('201'));
expect(fromJson.allianceColor, equals('red'));
});
});
}
Integration Tests
Test integration with The Blue Alliance API:
void main() {
group('TBA API Client', () {
test('should fetch event details correctly', () async {
final client = TBAApiClient(apiKey: 'YOUR_API_KEY');
final event = await client.getEvent('2025MITRY');
expect(event, isNotNull);
expect(event.name, contains('Michigan'));
});
});
}
Deployment Process
Building the APK
To build a release APK:
flutter build apk --release
Publishing to Amazon App Store
- Create a developer account on the Amazon App Store
- Prepare promotional materials and screenshots
- Upload the APK file
- Complete the listing information
- Submit for review
Contributing Guidelines
Code Style
Follow Flutter's official style guide:
- Use
dart format
to maintain consistent formatting - Follow the Effective Dart (opens in a new tab) guidelines
Pull Request Process
- Fork the repository
- Create a feature branch
- Implement your changes with appropriate tests
- Submit a pull request with detailed description
- Ensure CI checks pass
Version Control
- Use semantic versioning for releases
- Include descriptive commit messages
- Reference issue numbers in commits when applicable
Resources
- Flutter Documentation (opens in a new tab)
- Dart Language Tour (opens in a new tab)
- Hive Documentation (opens in a new tab)
- The Blue Alliance API Documentation (opens in a new tab)
By understanding the technical architecture and development workflow, you can effectively contribute to or modify the Scout-Ops-Android application to meet your team's specific scouting needs.