azarashi 0.12.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azarashi-0.12.0/LICENSE +21 -0
- azarashi-0.12.0/PKG-INFO +541 -0
- azarashi-0.12.0/README.md +518 -0
- azarashi-0.12.0/azarashi/__init__.py +5 -0
- azarashi-0.12.0/azarashi/__main__.py +61 -0
- azarashi-0.12.0/azarashi/network/__init__.py +0 -0
- azarashi-0.12.0/azarashi/network/receiver.py +63 -0
- azarashi-0.12.0/azarashi/network/transmitter.py +69 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/__init__.py +0 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/__init__.py +20 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/hex_qzss_dcr_decoder.py +36 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/net_qzss_dcr_decoder.py +41 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/nmea_qzss_dcr_decoder.py +89 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder.py +61 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_base.py +38 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma.py +132 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_ash_fall.py +65 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_common.py +177 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_earthquake_early_warning.py +76 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_flood.py +41 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_hypocenter.py +17 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_marine.py +40 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_nankai_trough_earthquake.py +29 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_northwest_pacific_tsunami.py +54 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_seismic_intensity.py +41 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_tsunami.py +55 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_typhoon.py +86 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_volcano.py +44 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcr_decoder_jma_weather.py +52 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/qzss_dcx_decoder.py +442 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/decoder/ublox_qzss_dcr_decoder.py +81 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/__init__.py +55 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/nmea_qzss_dcr_message_header.py +1 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_definition.py +28 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_ash_fall_warning_code.py +13 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_coastal_region.py +106 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_disaster_category.py +41 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_eew_forecast_region.py +79 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_epicenter_and_hypocenter.py +353 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_flood_forecast_region.py +454 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_flood_warning_level.py +13 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_information_serial_code.py +14 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_information_type.py +19 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_local_government.py +1896 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_long_period_ground_motion_lower_limit.py +14 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_long_period_ground_motion_upper_limit.py +15 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_marine_forecast_region.py +57 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_marine_warning_code.py +17 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_northwest_pacific_tsunami_height.py +15 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_notification_on_disaster_prevention.py +74 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_prefecture.py +54 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_report_classification.py +21 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_seismic_intensity.py +14 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_seismic_intensity_lower_limit.py +19 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_seismic_intensity_upper_limit.py +20 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_tsunami_forecast_region.py +107 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_tsunami_height.py +16 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_tsunami_warning_code.py +14 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_tsunamigenic_potential.py +14 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_typhoon_intensity_category.py +13 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_typhoon_reference_time_type.py +10 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_typhoon_scale_category.py +12 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_volcanic_warning_code.py +23 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_volcano_name.py +129 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_weather_forecast_region.py +83 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_weather_related_disaster_sub_category.py +19 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_jma_weather_warning_state.py +10 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_message_type.py +9 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_preamble.py +10 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcr_satellite_prn.py +12 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a10_library_version.py +15 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a11_international_library.py +79 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a11_japanese_library.py +90 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a17_main_subject_for_specific_settings.py +11 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a1_message_type.py +11 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a2_country_region_name.py +259 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a3_provider_identifier.py +77 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a4_hazard_category_and_type.py +361 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a5_severity.py +11 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a6_hazard_onset_week.py +9 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a8_hazard_duration.py +11 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_a9_selection_of_library.py +9 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_b4_lower_level_fields_tables.py +591 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_c10_guicance_library_for_second_ellipse.py +51 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_ex1_target_area_code.py +3975 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_camf_ex9_target_area_code.py +109 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/qzss_dcx_message_type.py +24 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/definition/ublox_qzss_dcr_message_header.py +7 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/exception/__init__.py +1 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/exception/qzss_dcr_exception.py +32 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/interface/__init__.py +4 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/interface/decoder_interface.py +117 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/interface/hex_interface.py +7 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/interface/nmea_interface.py +12 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/interface/ublox_interface.py +49 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/report/__init__.py +1 -0
- azarashi-0.12.0/azarashi/qzss_dcr_lib/report/qzss_dc_report.py +765 -0
- azarashi-0.12.0/azarashi.egg-info/PKG-INFO +541 -0
- azarashi-0.12.0/azarashi.egg-info/SOURCES.txt +103 -0
- azarashi-0.12.0/azarashi.egg-info/dependency_links.txt +1 -0
- azarashi-0.12.0/azarashi.egg-info/entry_points.txt +2 -0
- azarashi-0.12.0/azarashi.egg-info/top_level.txt +1 -0
- azarashi-0.12.0/setup.cfg +4 -0
- azarashi-0.12.0/setup.py +28 -0
- azarashi-0.12.0/tests/test.py +233 -0
azarashi-0.12.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 NBTK
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
azarashi-0.12.0/PKG-INFO
ADDED
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: azarashi
|
|
3
|
+
Version: 0.12.0
|
|
4
|
+
Summary: QZSS DCR Decoder
|
|
5
|
+
Home-page: https://github.com/nbtk/azarashi
|
|
6
|
+
Author: nbtk
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: license
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-python
|
|
22
|
+
Dynamic: summary
|
|
23
|
+
|
|
24
|
+
[](https://pepy.tech/project/azarashi)
|
|
25
|
+
|
|
26
|
+
<img src="https://raw.githubusercontent.com/nbtk/azarashi/refs/heads/main/logo.png" width="256">
|
|
27
|
+
|
|
28
|
+
# Azarashi
|
|
29
|
+
A QZSS DCR Decoder.
|
|
30
|
+
## Description
|
|
31
|
+
azarashi は準天頂衛星みちびきが送信する災危通報メッセージのデコーダーです。u-blox と Sony Spresense が出力するメッセージ形式に対応しています。災危通報(災害・危機管理通報サービス)とは、防災機関から発表される地震や津波発生時の災害情報などの危機管理情報を準天頂衛星みちびき経由で送信するサービスです。
|
|
32
|
+
## Installation
|
|
33
|
+
```shell
|
|
34
|
+
$ pip install azarashi
|
|
35
|
+
```
|
|
36
|
+
## Preparation
|
|
37
|
+
デバイスに災危通報メッセージを出力させるための設定例です。
|
|
38
|
+
### u-blox M10S < UART > Raspberry Pi 4 + Ubuntu 22.04 + ubxtool (CLI)
|
|
39
|
+
UARTを有効にするため、設定ファイルの末尾に `enable_uart=1` を追記します。
|
|
40
|
+
```shell
|
|
41
|
+
$ sudo vi /boot/firmware/config.txt
|
|
42
|
+
```
|
|
43
|
+
```shell
|
|
44
|
+
[all]
|
|
45
|
+
...
|
|
46
|
+
|
|
47
|
+
# Enable the UART port
|
|
48
|
+
enable_uart=1
|
|
49
|
+
```
|
|
50
|
+
再起動して、シリアルデバイスが認識されていることを確認します。
|
|
51
|
+
```shell
|
|
52
|
+
$ sudo reboot
|
|
53
|
+
```
|
|
54
|
+
`/dev/ttyS0` の状態を確認しましょう。
|
|
55
|
+
```shell
|
|
56
|
+
$ stat /dev/ttyS0
|
|
57
|
+
```
|
|
58
|
+
```shell
|
|
59
|
+
File: /dev/ttyS0
|
|
60
|
+
Size: 0 Blocks: 0 IO Block: 4096 character special file
|
|
61
|
+
Device: 5h/5d Inode: 602 Links: 1 Device type: 4,40
|
|
62
|
+
Access: (0660/crw-rw----) Uid: ( 0/ root) Gid: ( 20/ dialout)
|
|
63
|
+
...
|
|
64
|
+
```
|
|
65
|
+
もし `/dev/ttyS0` が存在しない場合は dmsg コマンドで確認しましょう。ファイル名が異なるか UART ポートを有効化する設定が間違っているか、有効化に失敗していることが考えられます。
|
|
66
|
+
```shell
|
|
67
|
+
$ sudo dmesg | grep serial
|
|
68
|
+
```
|
|
69
|
+
```shell
|
|
70
|
+
[ 0.525432] bcm2835-aux-uart fe215040.serial: there is not valid maps for state default
|
|
71
|
+
[ 0.527303] fe215040.serial: ttyS0 at MMIO 0xfe215040 (irq = 21, base_baud = 62500000) is a 16550
|
|
72
|
+
```
|
|
73
|
+
シリアルデバイスに `sudo` コマンドを使わずに読み書きしたいときは、ユーザを `dialout` グループに追加します。
|
|
74
|
+
```shell
|
|
75
|
+
$ sudo usermod -a -G dialout $USER
|
|
76
|
+
$ logout # then re-login to the machine
|
|
77
|
+
```
|
|
78
|
+
データシートを参照して直接インストラクションを流し込むか、設定ツールをつかって SFRBX メッセージの出力を有効にしてください。設定ツール ubxtool は下記のようにインストールします。
|
|
79
|
+
```shell
|
|
80
|
+
$ sudo apt update
|
|
81
|
+
$ sudo apt install gpsd gpsd-clients
|
|
82
|
+
```
|
|
83
|
+
SFRBX メッセージの出力に関連する設定コマンドの例です。
|
|
84
|
+
```shell
|
|
85
|
+
$ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,1,1 # sets 'enable' to ram
|
|
86
|
+
$ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,0,1 # sets 'disable' to ram
|
|
87
|
+
$ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,1,2 # sets 'enable' to bbr (battery-backed ram)
|
|
88
|
+
$ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,0,2 # sets 'disable' to bbr (battery-backed ram)
|
|
89
|
+
$ ubxtool -f /dev/ttyS0 -s 9600 -g CFG-MSGOUT-UBX_RXM_SFRBX_UART1 | grep -A3 UBX-CFG-VALGET # gets the state
|
|
90
|
+
```
|
|
91
|
+
デバイスに通電してから災危通報メッセージを出力し始めるまでしばらく時間がかかります。
|
|
92
|
+
### u-blox F9P < USB > Windows + u-center (GUI)
|
|
93
|
+
設定ツール [u-center](https://www.u-blox.com/en/product/u-center) をダウンロードし、インストールしてください。
|
|
94
|
+
|
|
95
|
+
u-center で SFRBX メッセージを出力するように設定してください。下記は SFRBX メッセージを USB に出力するための参考設定手順です。
|
|
96
|
+
```
|
|
97
|
+
Open u-center ->
|
|
98
|
+
View -> Configuration View ->
|
|
99
|
+
CFG (Configuration) -> Revert to default configuration -> Send
|
|
100
|
+
MSG (Messages) -> Messages -> 02-13 RXM-SFRBX ->
|
|
101
|
+
Check the "USB" box and type 1 in the "on" box -> Send
|
|
102
|
+
NMEA (NMEA Protocol) -> NMEA Version -> Select 4.11 -> Send
|
|
103
|
+
CFG (Configuration) -> Save current configuration -> Send
|
|
104
|
+
```
|
|
105
|
+
u-center で QZSS の L1S シグナル受信機能を有効にしてください。下記は GPS と QZSS のメッセージをすべて受信するための参考設定手順です。
|
|
106
|
+
```
|
|
107
|
+
Open u-center ->
|
|
108
|
+
View -> Generation 9 Configuration View -> GNSS Configuration ->
|
|
109
|
+
Check All the "GPS" and "QZSS" boxes ->
|
|
110
|
+
Check the "RAM" and "Flash" boxes in the "Write to layer" ->
|
|
111
|
+
Send Configuration
|
|
112
|
+
```
|
|
113
|
+
設定は永続化され、他の機器に接続し直しても災危通報メッセージを出力します。デバイスに通電してから災危通報メッセージを出力し始めるまでしばらく時間がかかります。
|
|
114
|
+
### Sony Spresense
|
|
115
|
+
[QZSS 災危通報 (QZQSM) の NMEA センテンスを出力するように設定してください。](https://developer.sony.com/develop/spresense/docs/arduino_tutorials_ja.html#_qzss_災危通報を出力する)
|
|
116
|
+
## CLI
|
|
117
|
+
azarashi コマンドをつかうとプログラミングすることなく災危通報メッセージをデコードできます。
|
|
118
|
+
```shell
|
|
119
|
+
$ echo '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05' | azarashi nmea
|
|
120
|
+
```
|
|
121
|
+
オプションは下記のとおりです。
|
|
122
|
+
```shell
|
|
123
|
+
usage: azarashi [-h] [-f INPUT] [-s] [-u] [-v] {hex,nmea,ublox}
|
|
124
|
+
|
|
125
|
+
azarashi CLI
|
|
126
|
+
|
|
127
|
+
positional arguments:
|
|
128
|
+
{hex,nmea,ublox} message type
|
|
129
|
+
|
|
130
|
+
options:
|
|
131
|
+
-h, --help show this help message and exit
|
|
132
|
+
-f INPUT, --input INPUT
|
|
133
|
+
input device (default: stdin)
|
|
134
|
+
-s, --source output the source messages (default: False)
|
|
135
|
+
-u, --unique supress duplicate messages (default: False)
|
|
136
|
+
-v, --verbose verbose mode (default: False)
|
|
137
|
+
```
|
|
138
|
+
### u-blox
|
|
139
|
+
stty コマンドでデバイスファイルを `raw` に設定し azarashi コマンドのメッセージタイプに `ublox` を指定します。デバイスファイルのパスは適宜変更してください。
|
|
140
|
+
```shell
|
|
141
|
+
$ stty -F /dev/ttyS0 raw
|
|
142
|
+
```
|
|
143
|
+
azarashi コマンドに ublox オプションを指定します。
|
|
144
|
+
```shell
|
|
145
|
+
$ azarashi ublox -f /dev/ttyS0
|
|
146
|
+
```
|
|
147
|
+
なお、デバイスファイルの読込権限が足りず sudo コマンドを使って python3 インタプリタを実行するとき azarashi モジュールも sudo で実行される python3 環境にインストールされている必要があることに注意してください。あるいは次のように実行しても動作は同じです。
|
|
148
|
+
```shell
|
|
149
|
+
$ sudo cat /dev/ttyS0 | azarashi ublox
|
|
150
|
+
```
|
|
151
|
+
### Sony Spresense
|
|
152
|
+
azarashi コマンドに nmea オプションを指定します。
|
|
153
|
+
```shell
|
|
154
|
+
$ azarashi nmea -f /dev/ttyUSB0
|
|
155
|
+
```
|
|
156
|
+
### Hexadecimal
|
|
157
|
+
azarashi コマンドのメッセージタイプに `hex` を指定してください。`hex` はヘッダ、チェックサムを含まない16進数文字列のメッセージ形式です。
|
|
158
|
+
```shell
|
|
159
|
+
$ echo C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC | azarashi hex
|
|
160
|
+
```
|
|
161
|
+
## API
|
|
162
|
+
### decode()
|
|
163
|
+
```python
|
|
164
|
+
azarashi.decode(msg, msg_type='nmea')
|
|
165
|
+
```
|
|
166
|
+
- `msg`: メッセージを渡してください。メッセージは str 型または bytes 型です。
|
|
167
|
+
- `msg_type`: デフォルトは `nmea` 、オプションとして `hex` または `ublox` を指定できます。`nmea` または `hex` を指定したときメッセージは str 型、`ublox` を指定したときメッセージは bytes 型です。
|
|
168
|
+
#### Example
|
|
169
|
+
デコードして得られたレポートオブジェクトを `str()` にわたすとヒューマンリーダブルな災害情報を返します。
|
|
170
|
+
```python
|
|
171
|
+
>>> import azarashi
|
|
172
|
+
>>> msg = '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05'
|
|
173
|
+
>>> report = azarashi.decode(msg, 'nmea')
|
|
174
|
+
>>> str(report)
|
|
175
|
+
'防災気象情報(緊急地震速報)(発表)(訓練/試験)\n*** これは訓練です ***\n緊急地震速報\n強い揺れに警戒してください。\n\n発表時刻: 3月10日10時0分\n\n震央地名: 日向震度(上限): 〜程度以上\n島根、岡山、広島、山口、香川、愛媛、高知、福岡、佐賀、長崎、熊本、大分、宮崎、鹿児島、中国、四国、九州'
|
|
176
|
+
```
|
|
177
|
+
つまりレポートオブジェクトを `print()` にわたせば災害情報を出力します。
|
|
178
|
+
```python
|
|
179
|
+
>>> print(report)
|
|
180
|
+
```
|
|
181
|
+
```
|
|
182
|
+
防災気象情報(緊急地震速報)(発表)(訓練/試験)
|
|
183
|
+
*** これは訓練です ***
|
|
184
|
+
緊急地震速報
|
|
185
|
+
強い揺れに警戒してください。
|
|
186
|
+
|
|
187
|
+
発表時刻: 3月10日10時0分
|
|
188
|
+
|
|
189
|
+
震央地名: 日向灘
|
|
190
|
+
地震発生時刻: 10日10時0分
|
|
191
|
+
深さ: 10km
|
|
192
|
+
マグニチュード: 7.2
|
|
193
|
+
震度(下限): 震度6弱
|
|
194
|
+
震度(上限): 〜程度以上
|
|
195
|
+
島根、岡山、広島、山口、香川、愛媛、高知、福岡、佐賀、長崎、熊本、大分、宮崎、鹿児島、中国、四国、九州
|
|
196
|
+
```
|
|
197
|
+
レポートオブジェクトからパラメータを取得するには `get_params()` メソッドを使います。
|
|
198
|
+
```python
|
|
199
|
+
>>> from pprint import pprint
|
|
200
|
+
>>> pprint(report.get_params())
|
|
201
|
+
```
|
|
202
|
+
```python
|
|
203
|
+
{'assumptive': False,
|
|
204
|
+
'depth_of_hypocenter': '10km',
|
|
205
|
+
'depth_of_hypocenter_raw': 10,
|
|
206
|
+
'disaster_category': '緊急地震速報',
|
|
207
|
+
'disaster_category_en': 'Earthquake Early Warning',
|
|
208
|
+
'disaster_category_no': 1,
|
|
209
|
+
'eew_forecast_regions': ['島根', '岡山', '広島', '山口', '香川', '愛媛',
|
|
210
|
+
'高知', '福岡', '佐賀', '長崎', '熊本', '大分',
|
|
211
|
+
'宮崎', '鹿児島', '中国', '四国', '九州'],
|
|
212
|
+
'eew_forecast_regions_raw': [37, 38, 39, 40, 42, 43,
|
|
213
|
+
44, 45, 46, 47, 48, 49,
|
|
214
|
+
50, 51, 66, 67, 68],
|
|
215
|
+
'information_type': '発表',
|
|
216
|
+
'information_type_en': 'Issue',
|
|
217
|
+
'information_type_no': 0,
|
|
218
|
+
'long_period_ground_motion_lower_limit': None,
|
|
219
|
+
'long_period_ground_motion_lower_limit_raw': 0,
|
|
220
|
+
'long_period_ground_motion_upper_limit': None,
|
|
221
|
+
'long_period_ground_motion_upper_limit_raw': 0,
|
|
222
|
+
'magnitude': '7.2',
|
|
223
|
+
'magnitude_raw': 72,
|
|
224
|
+
'message': b'\xc6\xaf\x89\xa8 \x00\x03$\x00\x00P@\x05H\xc5\xe2\xc0\x00\x00\x00'
|
|
225
|
+
b'\x03\xdf\xf8\x00\x1c\x00\x00\x11\x85D?\xc0',
|
|
226
|
+
'message_header': '$QZQSM',
|
|
227
|
+
'message_type': 'DCR',
|
|
228
|
+
'nmea': '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05',
|
|
229
|
+
'notifications_on_disaster_prevention': ['強い揺れに警戒してください。'],
|
|
230
|
+
'notifications_on_disaster_prevention_raw': [201],
|
|
231
|
+
'occurrence_time_of_earthquake': datetime.datetime(2024, 3, 10, 1, 0),
|
|
232
|
+
'preamble': 'C',
|
|
233
|
+
'raw': b'\xaf\x89\xa8 \x00\x03$\x00\x00P@\x05H\xc5\xe2\xc0\x00\x00\x00\x03'
|
|
234
|
+
b'\xdf\xf8\x00\x1c\x00\x00\x10',
|
|
235
|
+
'report_classification': '訓練/試験',
|
|
236
|
+
'report_classification_en': 'Training/Test',
|
|
237
|
+
'report_classification_no': 7,
|
|
238
|
+
'report_time': datetime.datetime(2024, 3, 10, 1, 0),
|
|
239
|
+
'satellite_id': 55,
|
|
240
|
+
'satellite_prn': 183,
|
|
241
|
+
'seismic_epicenter': '日向灘',
|
|
242
|
+
'seismic_epicenter_raw': 791,
|
|
243
|
+
'seismic_intensity_lower_limit': '震度6弱',
|
|
244
|
+
'seismic_intensity_lower_limit_raw': 8,
|
|
245
|
+
'seismic_intensity_upper_limit': '〜程度以上',
|
|
246
|
+
'seismic_intensity_upper_limit_raw': 11,
|
|
247
|
+
'sentence': '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05',
|
|
248
|
+
'timestamp': datetime.datetime(2024, 6, 21, 15, 40, 34, 960948),
|
|
249
|
+
'version': 1}
|
|
250
|
+
```
|
|
251
|
+
重複して受信した同一情報のメッセージかどうかは等価演算子で判別できます。
|
|
252
|
+
```python
|
|
253
|
+
>>> msg2 = '$QZQSM,55,9AAF89A820000324000050400548C5E2C000000003DFF8001C0000123FB3EB0*03'
|
|
254
|
+
>>> report2 = azarashi.decode(msg2, 'nmea')
|
|
255
|
+
>>> report == report2
|
|
256
|
+
```
|
|
257
|
+
```
|
|
258
|
+
True
|
|
259
|
+
```
|
|
260
|
+
### decode_stream()
|
|
261
|
+
```python
|
|
262
|
+
azarashi.decode_stream(stream, msg_type='nmea', callback=None, callback_args=(), callback_kwargs={}, unique=False, ignore_dcr=False, ignore_dcx=True)
|
|
263
|
+
```
|
|
264
|
+
- `stream`: I/Oストリームを渡してください。デバイスファイルを `open()` して渡すときは、事前に stty コマンドで `ublox` なら `raw` モード、`nmea` ならデフォルト設定にしてください。pySerial つかうときは stty コマンドによる設定は不要です。
|
|
265
|
+
- `msg_type`: デフォルトは `nmea` 、オプションとして `hex` または `ublox` を指定できます。
|
|
266
|
+
- `callback`: メッセージをデコードしたあとに実行されるコールバック関数です。`None` の場合 `decode_stream()` はメッセージをデコードするたびに結果を返します。コールバック関数が与えられた場合 `decode_stream()` は例外が発生しない限り繰り返しメッセージをデコードし、そのたびにコールバック関数に結果を渡して実行します。下記はコールバック関数のインタフェースです。
|
|
267
|
+
```python
|
|
268
|
+
callback(report, *callback_args, **callback_kwargs)
|
|
269
|
+
```
|
|
270
|
+
- `calback_args`: コールバック関数に渡される引数です。
|
|
271
|
+
- `callback_kwargs`: コールバック関数に渡されるキーワード引数です。
|
|
272
|
+
- `unique`: 重複したメッセージを無視したいときは `True` を指定してください。
|
|
273
|
+
- `ignore_dcr`: DCRメッセージを無視したいときは `True` を指定してください。デフォルトは `False` です。
|
|
274
|
+
- `ignore_dcx`: DCXメッセージを無視したくないときは `False` を指定してください。デフォルトは `True` です。
|
|
275
|
+
#### Example
|
|
276
|
+
指定したデバイスファイルを読み込み、デコードしたレポートオブジェクトを `print()` に渡します。
|
|
277
|
+
```python
|
|
278
|
+
>>> import azarashi
|
|
279
|
+
>>> f = open('/dev/ttyS0', mode='r')
|
|
280
|
+
>>> azarashi.decode_stream(f, msg_type='ublox', callback=print)
|
|
281
|
+
```
|
|
282
|
+
### QzssDcrDecoderException
|
|
283
|
+
この例外クラスは何らかの理由でデコードに失敗したときに送出されます。エラーメッセージを表示すると問題解決の一助となるでしょう。
|
|
284
|
+
### QzssDcrDecoderNotImplementedError
|
|
285
|
+
`NotImplementedError` を継承した例外クラスです。実験的な配信など、デコーダが対応していないメッセージを受け取ったときに送出されます。配信がはじまると騒々しいのでデバッグ以外ではこの例外を握りつぶしたほうがよいかもしれません。
|
|
286
|
+
## Examples
|
|
287
|
+
### I/O Stream
|
|
288
|
+
例外処理を加えた簡単なプログラムの例です。
|
|
289
|
+
```python
|
|
290
|
+
import azarashi
|
|
291
|
+
import sys
|
|
292
|
+
|
|
293
|
+
def example():
|
|
294
|
+
with open('/dev/ttyS0', mode='r') as f:
|
|
295
|
+
while True:
|
|
296
|
+
try:
|
|
297
|
+
azarashi.decode_stream(f, msg_type='ublox', callback=print)
|
|
298
|
+
except azarashi.QzssDcrDecoderException as e:
|
|
299
|
+
print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
|
|
300
|
+
except azarashi.QzssDcrDecoderNotImplementedError as e:
|
|
301
|
+
print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
|
|
302
|
+
except EOFError as e:
|
|
303
|
+
print(f'{e}', file=sys.stderr)
|
|
304
|
+
return 0
|
|
305
|
+
except Exception as e:
|
|
306
|
+
print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
|
|
307
|
+
return 1
|
|
308
|
+
|
|
309
|
+
exit(example())
|
|
310
|
+
```
|
|
311
|
+
### pySerial
|
|
312
|
+
[pySerial](https://pythonhosted.org/pyserial/) でシリアルポートを `open()` して `decode_stream()` に渡すこともできます。この方法では stty コマンドによる設定は不要です。
|
|
313
|
+
```python
|
|
314
|
+
import azarashi
|
|
315
|
+
import sys
|
|
316
|
+
import serial
|
|
317
|
+
import pprint
|
|
318
|
+
|
|
319
|
+
def handler(report):
|
|
320
|
+
pprint.pprint(report.get_params())
|
|
321
|
+
|
|
322
|
+
def example():
|
|
323
|
+
with serial.Serial('/dev/ttyS0', 9600) as ser:
|
|
324
|
+
while True:
|
|
325
|
+
try:
|
|
326
|
+
azarashi.decode_stream(ser, 'ublox', handler, unique=True)
|
|
327
|
+
except azarashi.QzssDcrDecoderException as e:
|
|
328
|
+
print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
|
|
329
|
+
except azarashi.QzssDcrDecoderNotImplementedError as e:
|
|
330
|
+
print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
|
|
331
|
+
except EOFError as e:
|
|
332
|
+
print(f'{e}', file=sys.stderr)
|
|
333
|
+
return 0
|
|
334
|
+
except Exception as e:
|
|
335
|
+
print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
|
|
336
|
+
return 1
|
|
337
|
+
|
|
338
|
+
exit(example())
|
|
339
|
+
```
|
|
340
|
+
## Network
|
|
341
|
+
GPS アンテナは屋外や窓際に設置する必要があるため、それが実際にデータを処理する装置の近くとは限りません。そこでデータを UDP パケットに載せて再送するスクリプトを書きました。IPv4/IPv6 両方に対応しています。簡単な実装なので、ソースを参考に改造するベースにもよいと思います。
|
|
342
|
+
### Transmitter
|
|
343
|
+
送信側のスクリプトです。デフォルトでは IPv6 リンクローカルマルチキャストアドレスにパケットを送信します。宛先アドレスを指定したい場合は -d オプションを使用してください。
|
|
344
|
+
```shell
|
|
345
|
+
$ python3 -m azarashi.network.transmitter -t ublox -f /dev/ttyS0
|
|
346
|
+
```
|
|
347
|
+
なお、デバイスファイルの読込権限が足りず sudo コマンドを使って python3 インタプリタを実行するとき azarashi モジュールも sudo で実行される python3 環境にインストールされている必要があることに注意してください。あるいは次のように実行しても動作は同じです。
|
|
348
|
+
```shell
|
|
349
|
+
$ sudo cat /dev/ttyS0 | python3 -m azarashi.network.transmitter -t ublox
|
|
350
|
+
```
|
|
351
|
+
オプションは下記のとおりです。
|
|
352
|
+
```
|
|
353
|
+
usage: transmitter.py [-h] [-d DST_HOST] [-p DST_PORT] [-t {hex,nmea,ublox}] [-f INPUT] [-u]
|
|
354
|
+
|
|
355
|
+
azarashi network transmitter
|
|
356
|
+
|
|
357
|
+
options:
|
|
358
|
+
-h, --help show this help message and exit
|
|
359
|
+
-d DST_HOST, --dst-host DST_HOST
|
|
360
|
+
destination host (default: ff02::1)
|
|
361
|
+
-p DST_PORT, --dst-port DST_PORT
|
|
362
|
+
destination port (default: 2112)
|
|
363
|
+
-t {hex,nmea,ublox}, --msg-type {hex,nmea,ublox}
|
|
364
|
+
message type (default: ublox)
|
|
365
|
+
-f INPUT, --input INPUT
|
|
366
|
+
input device (default: stdin)
|
|
367
|
+
-u, --unique supress duplicate messages (default: False)
|
|
368
|
+
```
|
|
369
|
+
### Receiver
|
|
370
|
+
受信側のスクリプトです。
|
|
371
|
+
```shell
|
|
372
|
+
$ python3 -m azarashi.network.receiver
|
|
373
|
+
```
|
|
374
|
+
オプションは下記のとおりです。
|
|
375
|
+
```
|
|
376
|
+
usage: receiver.py [-h] [-b BIND_ADDR] [-p BIND_PORT] [-i BIND_IFACE] [-v]
|
|
377
|
+
|
|
378
|
+
azarashi network receiver
|
|
379
|
+
|
|
380
|
+
optional arguments:
|
|
381
|
+
-h, --help show this help message and exit
|
|
382
|
+
-b BIND_ADDR, --bind-addr BIND_ADDR
|
|
383
|
+
address to bind (default: ::)
|
|
384
|
+
-p BIND_PORT, --bind-port BIND_PORT
|
|
385
|
+
port to bind (default: 2112)
|
|
386
|
+
-i BIND_IFACE, --bind-iface BIND_IFACE
|
|
387
|
+
iface to bind (default: any)
|
|
388
|
+
-v, --verbose verbose mode (default: False)
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## DCX
|
|
392
|
+
azarashi は DCX メッセージのデコードをサポートしています。下記は L-Alert をデコードする例です。
|
|
393
|
+
```python
|
|
394
|
+
>>> import azarashi
|
|
395
|
+
>>> msg = '$QZQSM,55,53B0604DE19524CDA305B2C1E355B57800000CCC000000000000001022A8188*7E' # l-alert
|
|
396
|
+
>>> report = azarashi.decode(msg, 'nmea')
|
|
397
|
+
>>> print(report)
|
|
398
|
+
```
|
|
399
|
+
```
|
|
400
|
+
### DCX Message - L-Alert ###
|
|
401
|
+
A1 - Message type: Alert
|
|
402
|
+
A2 - Country/region name: Japan
|
|
403
|
+
A3 - Provider identifier: Foundation for MultiMedia Communications
|
|
404
|
+
A4 - Hazard category and type: MET - Rainfall
|
|
405
|
+
A4 - Hazard definition: Rainfall greater than or equal to 50 mm in past 24 hours. Note: Precise threshold is according to each local standard.
|
|
406
|
+
A5 - Severity: Severe - Significant threat to life or property
|
|
407
|
+
A6A7 - Hazard onset: 2024-06-23 13:00:00
|
|
408
|
+
A8 - Hazard duration: 6H <= Duration < 12H
|
|
409
|
+
A11 - Guidance to react: Keep away from Water area.
|
|
410
|
+
A11 - Guidance to react (ja): 離れろ。水場。
|
|
411
|
+
A12 - Ellipse centre latitude: 35.688
|
|
412
|
+
A13 - Ellipse centre longitude: 139.691
|
|
413
|
+
A14 - Ellipse semi - major axis: 10.933
|
|
414
|
+
A15 - Ellipse semi - minor axis: 5.979
|
|
415
|
+
A16 - Ellipse azimuth: 45.0
|
|
416
|
+
A17 - Specific settings: B1 - Improved Resolution of Main Ellipse
|
|
417
|
+
C1 - Refined latitude of centre of main ellipse: 35.688
|
|
418
|
+
C2 - Refined longitude of centre of main ellipse: 139.691
|
|
419
|
+
C3 - Refined length of semi major axis: 10.933
|
|
420
|
+
C4 - Refined length of semi minor axis: 5.979
|
|
421
|
+
```
|
|
422
|
+
レポートオブジェクトからパラメータを取得するには `get_params()` メソッドを使います。
|
|
423
|
+
```python
|
|
424
|
+
>>> from pprint import pprint
|
|
425
|
+
>>> pprint(report.get_params(), sort_dicts=False)
|
|
426
|
+
```
|
|
427
|
+
```python
|
|
428
|
+
{'sentence': '$QZQSM,55,53B0604DE19524CDA305B2C1E355B57800000CCC000000000000001022A8188*7E',
|
|
429
|
+
'timestamp': datetime.datetime(2024, 6, 21, 15, 9, 5, 433111),
|
|
430
|
+
'message': b'S\xb0`M\xe1\x95$\xcd\xa3\x05\xb2\xc1\xe3U\xb5x\x00\x00\x0c\xcc'
|
|
431
|
+
b'\x00\x00\x00\x00\x00\x00\x00\x10"\xa8\x18\x80',
|
|
432
|
+
'nmea': '$QZQSM,55,53B0604DE19524CDA305B2C1E355B57800000CCC000000000000001022A8188*7E',
|
|
433
|
+
'message_header': '$QZQSM',
|
|
434
|
+
'satellite_id': 55,
|
|
435
|
+
'satellite_prn': 183,
|
|
436
|
+
'raw': b'M\xe1\x95$\xcd\xa3\x05\xb2\xc1\xe3U\xb5x\x00\x00\x0c\xcc\x00\x00\x00'
|
|
437
|
+
b'\x00\x00\x00\x00\x10',
|
|
438
|
+
'preamble': 'A',
|
|
439
|
+
'message_type': 'DCX',
|
|
440
|
+
'camf': <azarashi.qzss_dcr_lib.decoder.qzss_dcx_decoder.QzssDcxDecoder.decode.<locals>.CAMF object at 0x1023af6a0>,
|
|
441
|
+
'ignore_a12_to_a16': False,
|
|
442
|
+
'ignore_a17_to_a18': False,
|
|
443
|
+
'ignore_ex1': True,
|
|
444
|
+
'ignore_ex2_to_ex7': True,
|
|
445
|
+
'ignore_ex8_to_ex9': True,
|
|
446
|
+
'satellite_designation_mask_type': 'MT44 is for Japan or for use outside Japan',
|
|
447
|
+
'satellite_designation_mask': ['For Japan',
|
|
448
|
+
'For Japan',
|
|
449
|
+
'For Japan',
|
|
450
|
+
'For Japan',
|
|
451
|
+
'For Japan',
|
|
452
|
+
'For use outside Japan',
|
|
453
|
+
'For use outside Japan',
|
|
454
|
+
'For Japan',
|
|
455
|
+
'For Japan'],
|
|
456
|
+
'dcx_message_type': 'L-Alert',
|
|
457
|
+
'a1_message_type': 'Alert',
|
|
458
|
+
'a2_country_region_name': 'Japan',
|
|
459
|
+
'a3_provider_identifier': 'Foundation for MultiMedia Communications',
|
|
460
|
+
'a4_hazard_category': 'MET',
|
|
461
|
+
'a4_hazard_type': 'Rainfall',
|
|
462
|
+
'a4_hazard_definition': 'Rainfall greater than or equal to 50 mm in past 24 '
|
|
463
|
+
'hours. Note: Precise threshold is according to each '
|
|
464
|
+
'local standard.',
|
|
465
|
+
'a5_severity': 'Severe - Significant threat to life or property',
|
|
466
|
+
'a6_hazard_onset_week': 'Current',
|
|
467
|
+
'a7_hazard_onset_time_of_week': 'SUNDAY - 01:00 PM',
|
|
468
|
+
'a6a7_hazard_onset_datetime': datetime.datetime(2024, 6, 23, 13, 0),
|
|
469
|
+
'a8_hazard_duration': '6H <= Duration < 12H',
|
|
470
|
+
'a9_selection_of_library': 'Country/region guidance library',
|
|
471
|
+
'a10_library_version': '#1',
|
|
472
|
+
'a11_japanese_library': 'Keep away from Water area.',
|
|
473
|
+
'a11_japanese_library_ja': '離れろ。水場。',
|
|
474
|
+
'a12_ellipse_centre_latitude': 35.6882581826505,
|
|
475
|
+
'a13_ellipse_centre_longitude': 139.69085457500137,
|
|
476
|
+
'a14_ellipse_semi_major_axis': 10.932758602420911,
|
|
477
|
+
'a15_ellipse_semi_minor_axis': 5.978542029422428,
|
|
478
|
+
'a16_ellipse_azimuth': 45.0,
|
|
479
|
+
'a17_main_subject_for_specific_settings': 'B1 - Improved Resolution of Main '
|
|
480
|
+
'Ellipse',
|
|
481
|
+
'c1_refined_latitude_of_centre_of_main_ellipse': 35.6882581826505,
|
|
482
|
+
'c2_refined_longitude_of_centre_of_main_ellipse': 139.69085457500137,
|
|
483
|
+
'c3_refined_length_of_semi_major_axis': 10.932758602420911,
|
|
484
|
+
'c4_refined_length_of_semi_minor_axis': 5.978542029422428,
|
|
485
|
+
'dcx_version': 1}
|
|
486
|
+
```
|
|
487
|
+
ビットフィールドの値は `report.camf` オブジェクトに格納されています。
|
|
488
|
+
```python
|
|
489
|
+
print(report.camf.get_params())
|
|
490
|
+
```
|
|
491
|
+
```python
|
|
492
|
+
{'sdmt': 0, 'sdm': 96, 'a1': 1, 'a2': 111, 'a3': 1, 'a4': 74, 'a5': 2, 'a6': 0, 'a7': 9421, 'a8': 2, 'a9': 1, 'a10': 0, 'a11': 773, 'a12': 45761, 'a13': 116395, 'a14': 13, 'a15': 11, 'a16': 48, 'a17': 0, 'a18': 0, 'ex1': 13104, 'ex2': 0, 'ex3': 0, 'ex4': 0, 'ex5': 0, 'ex6': 0, 'ex7': 0, 'ex8': 0, 'ex9': 7376896189632872448, 'ex10': 0, 'vn': 1, 'c1': 0, 'c2': 0, 'c3': 0, 'c4': 0}
|
|
493
|
+
```
|
|
494
|
+
### DCX Message Types
|
|
495
|
+
DCX メッセージのデコード結果が格納されるレポートオブジェクトは下記のとおりです。
|
|
496
|
+
#### Null Message
|
|
497
|
+
CAMF フィールドが空のメッセージです。SD フィールドを監視するために使用します。不要なら無視してください。
|
|
498
|
+
```python
|
|
499
|
+
class QzssDcxNullMsg(QzssDcXtendedMessageBase)
|
|
500
|
+
```
|
|
501
|
+
#### Information from Organizations outside Japan
|
|
502
|
+
日本国外の機関から発報されたメッセージです。
|
|
503
|
+
```python
|
|
504
|
+
class QzssDcxOutsideJapan(QzssDcXtendedMessageBase)
|
|
505
|
+
```
|
|
506
|
+
#### L-Alert
|
|
507
|
+
```python
|
|
508
|
+
class QzssDcxLAlert(QzssDcXtendedMessageBase)
|
|
509
|
+
```
|
|
510
|
+
#### J-Alert
|
|
511
|
+
```python
|
|
512
|
+
class QzssDcxJAlert(QzssDcXtendedMessageBase)
|
|
513
|
+
```
|
|
514
|
+
#### Municipality-Transmitted Information [tentative name]
|
|
515
|
+
```python
|
|
516
|
+
class QzssDcxMTInfo(QzssDcXtendedMessageBase)
|
|
517
|
+
```
|
|
518
|
+
#### Unknown Message
|
|
519
|
+
日本の未定義の機関から発報されたメッセージです。azarashi はこのメッセージを正確にデコードできないでしょう。デバッグの目的以外では無視してください。
|
|
520
|
+
```python
|
|
521
|
+
class QzssDcxUnknown(QzssDcXtendedMessageBase)
|
|
522
|
+
```
|
|
523
|
+
## Note
|
|
524
|
+
IS-QZSS-DCR-014、IS-QZSS-DCX-003 をサポートしています。
|
|
525
|
+
## Tips
|
|
526
|
+
### UnicodeDecodeError
|
|
527
|
+
```
|
|
528
|
+
[UnicodeDecodeError] 'utf-8' codec can't decode byte 0xNN in position XX: ~
|
|
529
|
+
```
|
|
530
|
+
GPS モジュールと接続するインタフェースのボーレートが一致せず、壊れたビット列をデコードしようとして失敗していることが考えられます。ボーレートは例えば次のような値です。
|
|
531
|
+
```
|
|
532
|
+
9600, 19200, 38400, 57600, 115200
|
|
533
|
+
```
|
|
534
|
+
設定方法は GPS モジュール、stty または pySerial のマニュアルを参照してください。
|
|
535
|
+
### Encountered EOF
|
|
536
|
+
CLI でストリームを受けていた azarashi は、書き込み側がクローズすると Encountered EOF と stderr に出力して終了します。これは正常な動作です。その直前までエラーなく動作していたと解釈してください。
|
|
537
|
+
### DCX Satellite Designation Field
|
|
538
|
+
DCX メッセージの SD フィールドを監視する必要があるとき `decode.stream()` メソッドの `unique` オプションは指定しないでください。`unique` オプションを指定したとき、重複した DCX メッセージかどうかを判断するために SD フィールドの差異は考慮されません。SD フィールドが異なるメッセージでも CAMF フィールドが同じメッセージは同一とみなされます。したがって SD フィールドのみが異なるメッセージを取りこぼす可能性があり SD フィールドの変化を正確に監視できません。
|
|
539
|
+
###
|
|
540
|
+
## Feedback
|
|
541
|
+
イシュー報告、プルリクエスト、コメント等、なんでもよいのでフィードバックお待ちしています。星をもらうと開発が活発になります。
|