blob: 816017c2ce2b727756d5bd7e530e1cd7d9846be9 [file] [log] [blame]
Sylvain Munaut12ba7782014-06-16 10:13:40 +02001#pragma once
Alex Badeaab1246e2010-11-27 23:35:08 +02002
3#include <stdint.h>
4
Holger Hans Peter Freythera1e8bf72010-12-29 12:00:01 +01005/* GSM TS 03.41 definitions also TS 23.041*/
Alex Badeaab1246e2010-11-27 23:35:08 +02006
7/* Chapter 9.3.2 */
8struct gsm341_ms_message {
9 struct {
10 uint8_t code_hi:6;
11 uint8_t gs:2;
Holger Hans Peter Freythera1e8bf72010-12-29 12:00:01 +010012 uint8_t update:4;
13 uint8_t code_lo:4;
Alex Badeaab1246e2010-11-27 23:35:08 +020014 } serial;
15 uint16_t msg_id;
16 struct {
17 uint8_t language:4;
18 uint8_t group:4;
19 } dcs;
20 struct {
21 uint8_t total:4;
22 uint8_t current:4;
23 } page;
24 uint8_t data[0];
25} __attribute__((packed));
26
Holger Hans Peter Freyther9c559142010-12-29 21:14:20 +010027/* Chapter 9.4.1.3 */
28struct gsm341_etws_message {
29 struct {
30 uint8_t code_hi:4;
31 uint8_t popup:1;
32 uint8_t alert:1;
33 uint8_t gs:2;
34 uint8_t update:4;
35 uint8_t code_lo:4;
36 } serial;
37 uint16_t msg_id;
38 uint16_t warning_type;
39 uint8_t data[0];
40} __attribute__((packed));
41
Alex Badead126ab92011-01-15 19:43:42 +020042#define GSM341_MSG_CODE(ms) ((ms)->serial.code_lo | ((ms)->serial.code_hi << 4))
Holger Hans Peter Freythere05c7df2010-12-29 11:57:48 +010043
Alex Badeaab1246e2010-11-27 23:35:08 +020044/* Section 9.3.2.1 - Geographical Scope */
45#define GSM341_GS_CELL_WIDE_IMMED 0
46#define GSM341_GS_PLMN_WIDE 1
47#define GSM341_GS_LA_WIDE 2
48#define GSM341_GS_CELL_WIDE 3
Harald Weltea19717a2014-12-29 13:14:01 +010049
50/* Section 9.4.1.2.2 */
51#define GSM341_MSGID_EOTD_ASSISTANCE 0x03E8
52#define GSM341_MSGID_DGPS_CORRECTION 0x03E9
53#define GSM341_MSGID_DGPS_EPH_CLOCK_COR 0x03EA
54#define GSM341_MSGID_GPS_ALMANAC_OTHER 0x03EB
55#define GSM341_MSGID_ETWS_EARTHQUAKE 0x1100
56#define GSM341_MSGID_ETWS_TSUNAMI 0x1101
57#define GSM341_MSGID_ETWS_QUAKE_AND_TSUNAMI 0x1102
58#define GSM341_MSGID_ETWS_TEST 0x1103
59#define GSM341_MSGID_ETWS_OTHER 0x1104
60#define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL 0x1112
61#define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED 0x1113
62#define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY 0x1114
63#define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED 0x1115
64#define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY 0x1116
65#define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED 0x1117
66#define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY 0x1118
67#define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED 0x1119
68#define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY 0x111A
69#define GSM341_MSGID_ETWS_CMAS_AMBER 0x111B
70#define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST 0x111C
71#define GSM341_MSGID_ETWS_CMAS_EXERCISE 0x111D
72#define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED 0x111E
73#define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL_AL 0x111F
74#define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED_AL 0x1120
75#define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY_AL 0x1121
76#define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED_AL 0x1122
77#define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY_AL 0x1123
78#define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED_AL 0x1124
79#define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY_AL 0x1125
80#define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED_AL 0x1126
81#define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY_AL 0x1127
82#define GSM341_MSGID_ETWS_CMAS_AMBER_AL 0x1128
83#define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST_AL 0x1129
84#define GSM341_MSGID_ETWS_CMAS_EXERCISE_AL 0x112A
85#define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED_AL 0x112B
86#define GSM341_MSGID_ETWS_EU_INFO_LOCAL_LANGUAGE 0x1900