libosmogsm  0.9.3
Osmocom GSM library
include/osmocom/gsm/protocol/gsm_03_41.h
00001 #pragma once
00002 
00003 #include <stdint.h>
00004 
00005 #include <osmocom/gsm/protocol/gsm_04_12.h>
00006 
00007 /* GSM TS 03.41 definitions also TS 23.041*/
00008 
00009 #define GSM341_MAX_PAYLOAD      (GSM412_MSG_LEN-sizeof(struct gsm341_ms_message))
00010 #define GSM341_MAX_CHARS        (GSM341_MAX_PAYLOAD*8/7)
00011 #define GSM341_7BIT_PADDING     '\r'
00012 
00013 /* Chapter 9.3.2 */
00014 struct gsm341_ms_message {
00015         struct {
00016                 uint8_t code_hi:6;
00017                 uint8_t gs:2;
00018                 uint8_t update:4;
00019                 uint8_t code_lo:4;
00020         } serial;
00021         uint16_t msg_id;
00022         struct {
00023                 uint8_t language:4;
00024                 uint8_t group:4;
00025         } dcs;
00026         struct {
00027                 uint8_t total:4;
00028                 uint8_t current:4;
00029         } page;
00030         uint8_t data[0];
00031 } __attribute__((packed));
00032 
00033 /* Chapter 9.4.1.3 */
00034 struct gsm341_etws_message {
00035         struct {
00036                 uint8_t code_hi:4;
00037                 uint8_t popup:1;
00038                 uint8_t alert:1;
00039                 uint8_t gs:2;
00040                 uint8_t update:4;
00041                 uint8_t code_lo:4;
00042         } serial;
00043         uint16_t msg_id;
00044         uint16_t warning_type;
00045         uint8_t data[0];
00046 } __attribute__((packed));
00047 
00048 #define GSM341_MSG_CODE(ms) ((ms)->serial.code_lo | ((ms)->serial.code_hi << 4))
00049 
00050 /* Section 9.3.2.1 - Geographical Scope */
00051 #define GSM341_GS_CELL_WIDE_IMMED       0
00052 #define GSM341_GS_PLMN_WIDE             1
00053 #define GSM341_GS_LA_WIDE               2
00054 #define GSM341_GS_CELL_WIDE             3
00055 
00056 /* Section 9.4.1.2.2 */
00057 #define GSM341_MSGID_EOTD_ASSISTANCE                    0x03E8
00058 #define GSM341_MSGID_DGPS_CORRECTION                    0x03E9
00059 #define GSM341_MSGID_DGPS_EPH_CLOCK_COR                 0x03EA
00060 #define GSM341_MSGID_GPS_ALMANAC_OTHER                  0x03EB
00061 #define GSM341_MSGID_ETWS_EARTHQUAKE                    0x1100
00062 #define GSM341_MSGID_ETWS_TSUNAMI                       0x1101
00063 #define GSM341_MSGID_ETWS_QUAKE_AND_TSUNAMI             0x1102
00064 #define GSM341_MSGID_ETWS_TEST                          0x1103
00065 #define GSM341_MSGID_ETWS_OTHER                         0x1104
00066 #define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL             0x1112
00067 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED     0x1113
00068 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY       0x1114
00069 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED     0x1115
00070 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY       0x1116
00071 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED      0x1117
00072 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY        0x1118
00073 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED      0x1119
00074 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY        0x111A
00075 #define GSM341_MSGID_ETWS_CMAS_AMBER                    0x111B
00076 #define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST             0x111C
00077 #define GSM341_MSGID_ETWS_CMAS_EXERCISE                 0x111D
00078 #define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED         0x111E
00079 #define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL_AL          0x111F
00080 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED_AL  0x1120
00081 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY_AL    0x1121
00082 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED_AL  0x1122
00083 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY_AL    0x1123
00084 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED_AL   0x1124
00085 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY_AL     0x1125
00086 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED_AL   0x1126
00087 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY_AL     0x1127
00088 #define GSM341_MSGID_ETWS_CMAS_AMBER_AL                 0x1128
00089 #define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST_AL          0x1129
00090 #define GSM341_MSGID_ETWS_CMAS_EXERCISE_AL              0x112A
00091 #define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED_AL      0x112B
00092 #define GSM341_MSGID_ETWS_EU_INFO_LOCAL_LANGUAGE        0x1900