libosmogsm  0.11.0-dirty
Osmocom GSM library
include/osmocom/gsm/protocol/gsm_03_41.h
Go to the documentation of this file.
00001 
00004 #pragma once
00005 
00006 #include <stdint.h>
00007 
00008 #include <osmocom/core/endian.h>
00009 #include <osmocom/gsm/protocol/gsm_04_12.h>
00010 
00011 #ifndef OSMO_IS_LITTLE_ENDIAN
00012  #define OSMO_IS_LITTLE_ENDIAN 0
00013 #endif
00014 
00015 #define GSM341_MAX_PAYLOAD      (GSM412_MSG_LEN-sizeof(struct gsm341_ms_message))
00016 #define GSM341_MAX_CHARS        (GSM341_MAX_PAYLOAD*8/7)
00017 #define GSM341_7BIT_PADDING     '\r'
00018 
00019 /* Chapter 9.3.2 */
00020 struct gsm341_ms_message {
00021         struct {
00022 #if OSMO_IS_LITTLE_ENDIAN == 1
00023                 uint8_t code_hi:6;
00024                 uint8_t gs:2;
00025                 uint8_t update:4;
00026                 uint8_t code_lo:4;
00027 #else
00028                 uint8_t gs:2;
00029                 uint8_t code_hi:6;
00030                 uint8_t code_lo:4;
00031                 uint8_t update:4;
00032 #endif
00033         } serial;
00034         uint16_t msg_id;
00035         struct {
00036 #if OSMO_IS_LITTLE_ENDIAN == 1
00037                 uint8_t language:4;
00038                 uint8_t group:4;
00039 #else
00040                 uint8_t group:4;
00041                 uint8_t language:4;
00042 #endif
00043         } dcs;
00044         struct {
00045 #if OSMO_IS_LITTLE_ENDIAN == 1
00046                 uint8_t total:4;
00047                 uint8_t current:4;
00048 #else
00049                 uint8_t current:4;
00050                 uint8_t total:4;
00051 #endif
00052         } page;
00053         uint8_t data[0];
00054 } __attribute__((packed));
00055 
00056 /* Chapter 9.4.1.3 */
00057 struct gsm341_etws_message {
00058         struct {
00059 #if OSMO_IS_LITTLE_ENDIAN == 1
00060                 uint8_t code_hi:4;
00061                 uint8_t popup:1;
00062                 uint8_t alert:1;
00063                 uint8_t gs:2;
00064                 uint8_t update:4;
00065                 uint8_t code_lo:4;
00066 #else
00067                 uint8_t gs:2;
00068                 uint8_t alert:1;
00069                 uint8_t popup:1;
00070                 uint8_t code_hi:4;
00071                 uint8_t code_lo:4;
00072                 uint8_t update:4;
00073 #endif
00074         } serial;
00075         uint16_t msg_id;
00076         uint16_t warning_type;
00077         uint8_t data[0];
00078 } __attribute__((packed));
00079 
00080 #define GSM341_MSG_CODE(ms) ((ms)->serial.code_lo | ((ms)->serial.code_hi << 4))
00081 
00082 /* Section 9.3.2.1 - Geographical Scope */
00083 #define GSM341_GS_CELL_WIDE_IMMED       0
00084 #define GSM341_GS_PLMN_WIDE             1
00085 #define GSM341_GS_LA_WIDE               2
00086 #define GSM341_GS_CELL_WIDE             3
00087 
00088 /* Section 9.4.1.2.2 */
00089 #define GSM341_MSGID_EOTD_ASSISTANCE                    0x03E8
00090 #define GSM341_MSGID_DGPS_CORRECTION                    0x03E9
00091 #define GSM341_MSGID_DGPS_EPH_CLOCK_COR                 0x03EA
00092 #define GSM341_MSGID_GPS_ALMANAC_OTHER                  0x03EB
00093 #define GSM341_MSGID_ETWS_EARTHQUAKE                    0x1100
00094 #define GSM341_MSGID_ETWS_TSUNAMI                       0x1101
00095 #define GSM341_MSGID_ETWS_QUAKE_AND_TSUNAMI             0x1102
00096 #define GSM341_MSGID_ETWS_TEST                          0x1103
00097 #define GSM341_MSGID_ETWS_OTHER                         0x1104
00098 #define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL             0x1112
00099 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED     0x1113
00100 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY       0x1114
00101 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED     0x1115
00102 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY       0x1116
00103 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED      0x1117
00104 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY        0x1118
00105 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED      0x1119
00106 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY        0x111A
00107 #define GSM341_MSGID_ETWS_CMAS_AMBER                    0x111B
00108 #define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST             0x111C
00109 #define GSM341_MSGID_ETWS_CMAS_EXERCISE                 0x111D
00110 #define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED         0x111E
00111 #define GSM341_MSGID_ETWS_CMAS_PRESIDENTIAL_AL          0x111F
00112 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_OBSERVED_AL  0x1120
00113 #define GSM341_MSGID_ETWS_CMAS_EXTREME_IMM_LIKELY_AL    0x1121
00114 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_OBSERVED_AL  0x1122
00115 #define GSM341_MSGID_ETWS_CMAS_EXTREME_EXP_LIKELY_AL    0x1123
00116 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_OBSERVED_AL   0x1124
00117 #define GSM341_MSGID_ETWS_CMAS_SEVERE_IMM_LIKELY_AL     0x1125
00118 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_OBSERVED_AL   0x1126
00119 #define GSM341_MSGID_ETWS_CMAS_SEVERE_EXP_LIKELY_AL     0x1127
00120 #define GSM341_MSGID_ETWS_CMAS_AMBER_AL                 0x1128
00121 #define GSM341_MSGID_ETWS_CMAS_MONTHLY_TEST_AL          0x1129
00122 #define GSM341_MSGID_ETWS_CMAS_EXERCISE_AL              0x112A
00123 #define GSM341_MSGID_ETWS_CMAS_OPERATOR_DEFINED_AL      0x112B
00124 #define GSM341_MSGID_ETWS_EU_INFO_LOCAL_LANGUAGE        0x1900
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines