aboutsummaryrefslogtreecommitdiff
path: root/packet.h
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-01-20 14:03:21 +1300
committerDavid Phillips <dbphillipsnz@gmail.com>2016-01-20 14:03:21 +1300
commitb9fc5fed91512208d861e287b1369f3122861144 (patch)
treee11e3cc823b19feed7fb6c84d92990e9585e3d8b /packet.h
downloadcasio-9850-b9fc5fed91512208d861e287b1369f3122861144.tar.xz
Initial import
Diffstat (limited to 'packet.h')
-rw-r--r--packet.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/packet.h b/packet.h
new file mode 100644
index 0000000..4850cb6
--- /dev/null
+++ b/packet.h
@@ -0,0 +1,32 @@
+#ifndef PACKET_H
+#define PACKET_H
+
+#define MISC_ACK 0x06
+
+/*#define REQUEST_TYPE_VAR 0x4D56 // VM
+#define REQUEST_TYPE_PICTURE 0x4350 // PC
+#define REQUEST_TYPE_LIST 0x544C // LT
+#define REQUEST_TYPE_MATRIX 0x544D // MT
+*/
+
+#define PKT_HEADER_MAX_SIZE 50
+
+
+enum packet_types
+{
+ PKT_END,
+ PKT_VALUE_HEADER,
+ PKT_SCREEN_HEADER_BW,
+ PKT_SCREEN_HEADER_COL,
+ PKT_BACKUP_HEADER,
+ PKT_PROGRAM_HEADER,
+ PKT_FUNCTION_HEADER,
+ PKT_VAL,
+ PKT_UNKNOWN
+};
+
+unsigned char calculate_checksum(const char *start, const char *stop);
+unsigned short calculate_checksum_word(const char *start, const char *stop);
+enum packet_types get_packet_type(const unsigned char* data);
+
+#endif