Skip to content

Conversation

@YumNumm
Copy link
Owner

@YumNumm YumNumm commented Nov 30, 2025

Note

Add QZSS DCR reception over serial (u‑blox UBX → $QZQSM) with providers, UI, and macOS serial entitlement, integrating a new UbloxDecoder.

  • QZSS DCR feature (app):
    • Service: QzssSerialPortService reads serial (libserialport_plus), enables UBX-RXM-SFRBX, parses UBX/NMEA, converts via UbloxDecoderNmeaDecoder, and streams QzssDcReport.
    • State/Providers: QzssSerialPortState (freezed) and Riverpod providers (availableSerialPorts, QzssSerialPortConnection, LatestQzssDcReport).
    • UI: QzssDcrReportWidget to display decoded report details and raw $QZQSM.
    • Docs: Add feature/qzss_dcr/README.md (usage, architecture, specs).
  • Library (dart_azarashi):
    • Implement UbloxDecoder to validate UBX-RXM-SFRBX, extract QZSS payload, and emit $QZQSM sentences.
    • Add dependency libserialport_plus in packages/dart_azarashi/pubspec.yaml.
  • Config/Deps:
    • Add macOS entitlement com.apple.security.device.serial in DebugProfile.entitlements and Release.entitlements.
    • Add dart_azarashi and libserialport_plus to app/pubspec.yaml.
    • Tweak app/ExportOptions.plist keys/values.

Written by Cursor Bugbot for commit 548e335. This will update automatically on new commits. Configure here.

- UbloxDecoderクラスを実装
- UBX-RXM-SFRBXメッセージから$QZQSMセンテンスへの変換をサポート
- libserialport_plus依存関係を追加
- QzssSerialPortService: シリアルポート接続とデータ受信を管理
- Riverpodプロバイダー: 接続状態と災危通報の状態管理
- QzssSerialPortSettingsPage: シリアルポート設定画面
- QzssDcrReportWidget: 災危通報表示ウィジェット
- libserialport_plusとdart_azarashiの依存関係を追加
- QzssDcrPage: 災危通報の表示と設定へのナビゲーション
- 接続状態表示カード
- 機能概要と使い方
- 技術仕様とアーキテクチャ
- 参考資料
- DebugProfile.entitlementsとRelease.entitlementsに
  com.apple.security.device.serial権限を追加
- QZSS災危通報機能でシリアルポート接続を可能に
- Widgetを返す関数をprivate classに変更(_InfoRow, _JmaInfoCard)
- 1箇所でしか使用しない関数を変数として定義
  - disasterCategoryText
  - reportClassificationText
  - informationTypeText
- コードフォーマット修正
Signed-off-by: YumNumm <admin@yumnumm.dev>
Signed-off-by: YumNumm <admin@yumnumm.dev>
@YumNumm YumNumm merged commit dcc8c60 into develop Nov 30, 2025
7 of 8 checks passed
@YumNumm YumNumm deleted the feature/dart-azarashi-serial-port branch November 30, 2025 02:29
@github-actions github-actions bot mentioned this pull request Nov 28, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 20

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

hexData.write(data[i].toRadixString(16).padLeft(2, '0'));
}
// 最後のバイトの上位2ビットを追加
hexData.write(((data[31] & 0xC0) >> 4).toRadixString(16));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect bit extraction in UBX decoder

The bit mask 0xC0 extracts only the upper 2 bits instead of the required upper 4 bits for 252-bit data encoding. The expression ((data[31] & 0xC0) >> 4) produces values 0, 4, 8, or 12 only, missing values 1-3, 5-7, 9-11, and 13-15. The mask should be 0xF0 to extract the full upper nibble, matching the pattern used in qzss_dcr_decoder.dart lines 57 and 62.

Fix in Cursor Fix in Web

if (stream != null) {
stream.listen((report) {
state = report;
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Stream subscription memory leak in build method

The build method creates a stream listener without storing or canceling the subscription. Each time build executes (on provider rebuild), a new listener is created while old ones remain active, causing memory leaks. The subscription should be stored and properly disposed, or the stream should be converted to an AsyncValue using ref.listen or similar patterns.

Fix in Cursor Fix in Web

baudRate: baudRate,
error: e.toString(),
);
rethrow;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Resource leak when connection fails

When _service.connect() throws an exception, the catch block updates state but doesn't clean up the partially-initialized _service object. This leaves _service pointing to an object with potentially unclosed serial port resources (if the connection failed after opening the port). The service should be disposed and set to null in the error path to prevent resource leaks.

Fix in Cursor Fix in Web

}
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Unbounded buffer growth with invalid data

When incoming bytes don't match UBX or NMEA start sequences and no message reading is in progress, bytes accumulate in _buffer indefinitely without being cleared. This causes unbounded memory growth when receiving invalid or unexpected data. The buffer needs a size limit or garbage bytes should be discarded when not in an active reading state.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants