diff options
Diffstat (limited to 'src/host')
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/l1ctl.h | 2 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/osmocom_data.h | 6 | ||||
-rw-r--r-- | src/host/layer23/include/osmocom/bb/ui/ui.h | 3 | ||||
-rw-r--r-- | src/host/layer23/src/common/l1ctl.c | 36 | ||||
-rw-r--r-- | src/host/layer23/src/mobile/app_mobile.c | 7 | ||||
-rw-r--r-- | src/host/layer23/src/ui/ui.c | 7 |
6 files changed, 60 insertions, 1 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h index 3cf014e4..d05c64d8 100644 --- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h +++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h @@ -77,4 +77,6 @@ int l1ctl_tx_neigh_pm_req(struct osmocom_ms *ms, int num, uint16_t *arfcn); /* Transmit L1CTL_RINGER_REQ */ int l1ctl_tx_ringer_req(struct osmocom_ms *ms, uint8_t volume); +int l1ctl_tx_display_req(struct osmocom_ms *ms, int x, int y, char *text); + #endif diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h index 191fb96d..b69a8267 100644 --- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h +++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h @@ -97,6 +97,7 @@ enum osmobb_l1ctl_sig { S_L1CTL_TCH_MODE_CONF, S_L1CTL_LOSS_IND, S_L1CTL_NEIGH_PM_IND, + S_L1CTL_KEYPAD, }; enum osmobb_global_sig { @@ -134,4 +135,9 @@ struct osmobb_neigh_pm_ind { uint8_t bsic; }; +struct osmobb_keypad { + struct osmocom_ms *ms; + uint8_t key; +}; + #endif diff --git a/src/host/layer23/include/osmocom/bb/ui/ui.h b/src/host/layer23/include/osmocom/bb/ui/ui.h index 75e2fad7..b2bd26f6 100644 --- a/src/host/layer23/include/osmocom/bb/ui/ui.h +++ b/src/host/layer23/include/osmocom/bb/ui/ui.h @@ -3,7 +3,7 @@ #define UI_ROWS 8 #define UI_COLS 12 -#define UI_TARGET 0 +#define UI_TARGET 1 enum ui_key { UI_KEY_0 = '0', @@ -20,6 +20,7 @@ enum ui_key { UI_KEY_HASH = '#', UI_KEY_F1 = 1, UI_KEY_F2 = 2, + UI_KEY_MENU = 25, UI_KEY_PICKUP = 26, UI_KEY_HANGUP = 27, UI_KEY_UP = 28, diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c index 70fefec5..3804aae7 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -950,6 +950,38 @@ int l1ctl_tx_ringer_req(struct osmocom_ms *ms, uint8_t volume) return osmo_send_l1(ms, msg); } +static int rx_l1_keypad_ind(struct osmocom_ms *ms, struct msgb *msg) +{ + struct l1ctl_keypad_ind *kp_ind; + struct osmobb_keypad kp; + + kp_ind = (struct l1ctl_keypad_ind *) msg->l1h; + + kp.ms = ms; + kp.key = kp_ind->key; + osmo_signal_dispatch(SS_L1CTL, S_L1CTL_KEYPAD, &kp); + + return 0; +} + +/* Transmit L1CTL_NEIGH_PM_REQ */ +int l1ctl_tx_display_req(struct osmocom_ms *ms, int x, int y, char *text) +{ + struct msgb *msg; + struct l1ctl_display_req *dr; + + msg = osmo_l1_alloc(L1CTL_DISPLAY_REQ); + if (!msg) + return -1; + + dr = (struct l1ctl_display_req *) msgb_put(msg, sizeof(*dr)); + dr->x = x; + dr->y = y; + strncpy(dr->text, text, sizeof(dr->text) - 1); + + return osmo_send_l1(ms, msg); +} + /* Receive incoming data from L1 using L1CTL format */ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg) { @@ -1016,6 +1048,10 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg) case L1CTL_TRAFFIC_CONF: msgb_free(msg); break; + case L1CTL_KEYPAD_IND: + rc = rx_l1_keypad_ind(ms, msg); + msgb_free(msg); + break; default: LOGP(DL1C, LOGL_ERROR, "Unknown MSG: %u\n", l1h->msg_type); msgb_free(msg); diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 1473e77c..56c6b654 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -83,6 +83,7 @@ int mobile_signal_cb(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data) { struct osmocom_ms *ms; + struct osmobb_keypad *kp; struct gsm_settings *set; struct msgb *nmsg; @@ -131,6 +132,12 @@ int mobile_signal_cb(unsigned int subsys, unsigned int signal, } ms->started = 1; + break; + case S_L1CTL_KEYPAD: + kp = signal_data; + ms = kp->ms; + ui_inst_keypad(&ms->gui.ui, kp->key); + break; } return 0; } diff --git a/src/host/layer23/src/ui/ui.c b/src/host/layer23/src/ui/ui.c index 5545a5e7..5956b233 100644 --- a/src/host/layer23/src/ui/ui.c +++ b/src/host/layer23/src/ui/ui.c @@ -25,6 +25,7 @@ #include <osmocom/core/select.h> #include <osmocom/bb/ui/ui.h> #include <osmocom/bb/ui/telnet_interface.h> +#include <osmocom/bb/common/l1ctl.h> static char *ui_center(const char *text) { @@ -101,6 +102,12 @@ int ui_flush(struct ui_inst *ui) ui_telnet_puts(ui, frame); for (i = 0; i < UI_ROWS; i++) { sprintf(line, "|%s|\r\n", ui->buffer + (UI_COLS + 1) * i); + { + // HACK + struct gsm_ui *gui = container_of(ui, struct gsm_ui, ui); + struct osmocom_ms *ms = container_of(gui, struct osmocom_ms, gui); + l1ctl_tx_display_req(ms, 0, i, ui->buffer + (UI_COLS + 1) * i); + } ui_telnet_puts(ui, line); } ui_telnet_puts(ui, frame); |