From fb7be589e6f2a7e8dcbd560a0b0fdbda7d1fd316 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Mon, 31 Oct 2011 18:14:03 +0100 Subject: host/mobile/sms: Adding SMS support for osmocomBB/mobile Both MO and MT SMS are supported. Transmission an reception can be controlled via VTY: en sms 1 All received SMS are stored in "~/.osmocom/bb/sms.txt". SMS transmission is performed on SAPI 3 datalink, using DCCH or ACCH. Written-by: Andreas Eversberg Signed-off-by: Sylvain Munaut --- .../layer23/include/osmocom/bb/mobile/Makefile.am | 5 ++-- .../layer23/include/osmocom/bb/mobile/gsm411_sms.h | 33 ++++++++++++++++++++++ .../layer23/include/osmocom/bb/mobile/settings.h | 3 ++ .../include/osmocom/bb/mobile/transaction.h | 12 ++++---- 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h (limited to 'src/host/layer23/include/osmocom/bb/mobile') diff --git a/src/host/layer23/include/osmocom/bb/mobile/Makefile.am b/src/host/layer23/include/osmocom/bb/mobile/Makefile.am index 65b7ce76..7f49d5e9 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/Makefile.am +++ b/src/host/layer23/include/osmocom/bb/mobile/Makefile.am @@ -1,2 +1,3 @@ -noinst_HEADERS = gsm322.h gsm48_cc.h gsm48_mm.h gsm48_rr.h mncc.h settings.h \ - subscriber.h support.h transaction.h vty.h mncc_sock.h +noinst_HEADERS = gsm322.h gsm411_sms.h gsm48_cc.h gsm48_mm.h gsm48_rr.h mncc.h \ + settings.h subscriber.h support.h transaction.h vty.h \ + mncc_sock.h diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h b/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h new file mode 100644 index 00000000..61019de6 --- /dev/null +++ b/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h @@ -0,0 +1,33 @@ +#ifndef _GSM411_SMS_H +#define _GSM411_SMS_H + +#define SMS_HDR_SIZE 128 +#define SMS_TEXT_SIZE 256 + +struct gsm_sms { + unsigned long validity_minutes; + uint8_t reply_path_req; + uint8_t status_rep_req; + uint8_t ud_hdr_ind; + uint8_t protocol_id; + uint8_t data_coding_scheme; + uint8_t msg_ref; + char address[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes + * BCD == 20 bytes string */ + time_t time; + uint8_t user_data_len; + uint8_t user_data[SMS_TEXT_SIZE]; + + char text[SMS_TEXT_SIZE]; +}; + +int gsm411_sms_init(struct osmocom_ms *ms); +int gsm411_sms_exit(struct osmocom_ms *ms); +struct gsm_sms *sms_alloc(void); +void sms_free(struct gsm_sms *sms); +struct gsm_sms *sms_from_text(const char *receiver, int dcs, const char *text); +int gsm411_tx_sms_submit(struct osmocom_ms *ms, struct gsm_sms *sms); +int gsm411_rcv_sms(struct osmocom_ms *ms, struct msgb *msg); +int sms_send(struct osmocom_ms *ms, const char *number, const char *text); + +#endif /* _GSM411_SMS_H */ diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h index cd1b8001..8442f038 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/settings.h +++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h @@ -23,6 +23,9 @@ struct gsm_settings { int sim_type; /* selects card on power on */ char emergency_imsi[16]; + /* SMS */ + char sms_sca[12]; + /* test card simulator settings */ char test_imsi[16]; uint32_t test_tmsi; diff --git a/src/host/layer23/include/osmocom/bb/mobile/transaction.h b/src/host/layer23/include/osmocom/bb/mobile/transaction.h index aa62f465..b0695ecb 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/transaction.h +++ b/src/host/layer23/include/osmocom/bb/mobile/transaction.h @@ -2,6 +2,8 @@ #define _TRANSACT_H #include +#include +#include /* One transaction */ struct gsm_trans { @@ -38,18 +40,14 @@ struct gsm_trans { struct osmo_timer_list timer; struct gsm_mncc msg; /* stores setup/disconnect/release message */ } cc; -#if 0 struct { - uint8_t link_id; /* RSL Link ID to be used for this trans */ - int is_mt; /* is this a MO (0) or MT (1) transfer */ - enum gsm411_cp_state cp_state; - struct osmo_timer_list cp_timer; + uint8_t sapi; /* SAPI to be used for this trans */ - enum gsm411_rp_state rp_state; + struct gsm411_smc_inst smc_inst; + struct gsm411_smr_inst smr_inst; struct gsm_sms *sms; } sms; -#endif }; }; -- cgit v1.2.3