summaryrefslogtreecommitdiff
path: root/code/fe310/eos
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-08-05 02:07:17 +0200
committerUros Majstorovic <majstor@majstor.org>2020-08-05 02:07:17 +0200
commitdff71bc297b744856e303ad9a175de92c9acae0d (patch)
tree3954dcafcdc8fcd374535a00cc6a47133594b3ed /code/fe310/eos
parent3a2958ab8268b3388c780f902e74ad0c0d24c5c9 (diff)
cell message type support
Diffstat (limited to 'code/fe310/eos')
-rw-r--r--code/fe310/eos/cell.c11
-rw-r--r--code/fe310/eos/cell.h35
2 files changed, 35 insertions, 11 deletions
diff --git a/code/fe310/eos/cell.c b/code/fe310/eos/cell.c
index 3ce81f9..2421f4b 100644
--- a/code/fe310/eos/cell.c
+++ b/code/fe310/eos/cell.c
@@ -15,10 +15,11 @@ static void cell_handle_evt(unsigned char type, unsigned char *buffer, uint16_t
eos_net_bad_handler(type, buffer, len);
return;
}
-
unsigned char mtype = buffer[0];
- if (mtype < EOS_CELL_MAX_MTYPE) {
- evt_handler[mtype](type, buffer, len);
+ unsigned char idx = (mtype & EOS_CELL_MTYPE_MASK) >> 4;
+
+ if (idx < EOS_CELL_MAX_MTYPE) {
+ evt_handler[idx](type, buffer, len);
} else {
eos_net_bad_handler(type, buffer, len);
}
@@ -40,6 +41,8 @@ void eos_cell_init(void) {
}
void eos_cell_set_handler(unsigned char mtype, eos_evt_handler_t handler) {
+ unsigned char idx = (mtype & EOS_CELL_MTYPE_MASK) >> 4;
+
if (handler == NULL) handler = eos_net_bad_handler;
- if (mtype < EOS_CELL_MAX_MTYPE) evt_handler[mtype] = handler;
+ if (idx < EOS_CELL_MAX_MTYPE) evt_handler[idx] = handler;
}
diff --git a/code/fe310/eos/cell.h b/code/fe310/eos/cell.h
index 7691ff6..d93967a 100644
--- a/code/fe310/eos/cell.h
+++ b/code/fe310/eos/cell.h
@@ -1,17 +1,38 @@
#include <stdint.h>
#include "event.h"
+#define EOS_CELL_MTYPE_DEV 0x00
+#define EOS_CELL_MTYPE_VOICE 0x10
+#define EOS_CELL_MTYPE_SMS 0x20
+#define EOS_CELL_MTYPE_CBS 0x30
+#define EOS_CELL_MTYPE_USSD 0x40
+#define EOS_CELL_MTYPE_DATA 0x70
+
+#define EOS_CELL_MTYPE_MASK 0xf0
+#define EOS_CELL_MAX_MTYPE 8
+
#define EOS_CELL_MTYPE_READY 0
-#define EOS_CELL_MTYPE_DATA 1
-#define EOS_CELL_MTYPE_AUDIO 2
+#define EOS_CELL_MTYPE_UART_DATA 1
+#define EOS_CELL_MTYPE_UART_TAKE 2
+#define EOS_CELL_MTYPE_UART_GIVE 3
+#define EOS_CELL_MTYPE_PCM_DATA 4
+#define EOS_CELL_MTYPE_PCM_START 5
+#define EOS_CELL_MTYPE_PCM_STOP 6
-#define EOS_CELL_MTYPE_DATA_START 4
-#define EOS_CELL_MTYPE_DATA_STOP 5
+#define EOS_CELL_MTYPE_VOICE_DIAL 1
+#define EOS_CELL_MTYPE_VOICE_RING 2
+#define EOS_CELL_MTYPE_VOICE_ANSWER 3
+#define EOS_CELL_MTYPE_VOICE_HANGUP 4
+#define EOS_CELL_MTYPE_VOICE_BEGIN 5
+#define EOS_CELL_MTYPE_VOICE_END 6
-#define EOS_CELL_MTYPE_AUDIO_START 6
-#define EOS_CELL_MTYPE_AUDIO_STOP 7
+#define EOS_CELL_MTYPE_USSD_REQUEST 1
+#define EOS_CELL_MTYPE_USSD_REPLY 2
-#define EOS_CELL_MAX_MTYPE 4
+#define EOS_CELL_UART_MODE_NONE 0
+#define EOS_CELL_UART_MODE_ATCMD 1
+#define EOS_CELL_UART_MODE_PPP 2
+#define EOS_CELL_UART_MODE_RELAY 3
void eos_cell_init(void);
void eos_cell_set_handler(unsigned char mtype, eos_evt_handler_t handler); \ No newline at end of file