1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
Using protocol 7
================
You can communicate directly with your device on a link that uses protocol
seven. This protocol is not linked directly to the file formats used on
storage or main memories, on the contrary to the CAS protocols.
This interface hides you some of the horrors the protocol uses, such as
the escaping method, but you know… it can't hide 'em all.
Packet representation
---------------------
Everything starts with the packet representation:
.. c:type:: casio_seven_packet_t
A protocol seven packet, as an abstract object.
That packet can have several types:
.. c:type:: casio_seven_type_t
A protocol seven packet type, as an enumeration with the following values:
.. c:macro:: casio_seven_type_cmd
Ask something to the passive device, and initialize a packet flow
relative to the issued command.
.. c:macro:: casio_seven_type_data
Send data as a flow.
.. c:macro:: casio_seven_type_swp
Swap roles between the active and passive device (but the device
which becomes active has a very specific role defined by the
previously issued command and its packet flow).
.. c:macro:: casio_seven_type_chk
Check if there's an interlocutor, and initiate the connection by
the way (as the passive device is not supposed to answer to any
command until it has received a check packet and responded to it).
.. c:macro:: casio_seven_type_ack
Acknowledge, i.e. say “I have received and understood your message”
and, in case of a command, “I am willing to do what you're ordering
me to”.
.. c:macro:: casio_seven_type_ohp
Send a screen capture while in screenstreaming. The name “ohp”
comes from the original representation of such a mode, as the
“overhead projector” mode.
.. c:macro:: casio_seven_type_nak
Acknowledge negatively, i.e. say “I have received but not understood
your message” or, in case of a command, “I am not willing to do what
you're ordering me to”. Such a packet usually says a little bit more
about what the error is about.
.. c:macro:: casio_seven_type_end
Terminate the communication from the active side, to which, before
it is terminated, the passive side must acknowledge.
There are several check types:
.. c:type:: casio_seven_chk_t
The check packet subtype represents the context in which the check
packet is sent:
.. c:macro:: casio_seven_chk_ini
The check is the initial check to see if there is a device right
at the beginning of the communication.
.. c:macro:: casio_seven_chk_wait
The check is a timeout check, to see if the device is still there
and processing the command or if it has been disconnected. This
was made for serial lines where you could not see if there was
still a device on the other end or not, whether on USB you can
(but this type of check packets still exists on it).
There also are several error types:
.. c:type:: casio_seven_err_t
The error packet subtypes represents the errors.
.. c:macro:: casio_seven_err_default
The default error type (probably unused?).
.. c:macro:: casio_seven_err_resend
There was a checksum or timeout error, this packet is used for
asking a packet resend. Please don't use this packet directly, and
let the library manage this for you.
.. c:macro:: casio_seven_err_overwrite
The server wants a confirmation, either an ACK packet of type
:c:macro:`casio_seven_ack_ow` or an error packet of type
:c:macro:`casio_seven_error_dont_overwrite`.
.. c:macro:: casio_seven_err_dont_overwrite
When the passive device sends :c:macro:`casio_seven_err_overwrite`,
you can choose to say no by sending an error packet of this type.
.. c:macro:: casio_seven_err_other
This error type is the generic error type that can mean many things:
invalid or unsupported command, invalid argument, etc.
.. c:macro:: casio_seven_err_fullmem
When you try to create a file and the calculator hasn't got enough
memory left, it sends this error and immediately terminates the
connection (without the terminate packet).
There also are several acknowledge types:
.. c:type:: casio_seven_ack_t
The acknowledge type can be used in various contexts:
.. c:macro:: casio_seven_ack_normal
The normal acknowledge kind, accepts the command and report a
successful execution or respond to check, data, terminate or
role swap packets.
.. c:macro:: casio_seven_ack_ow
When the passive device has responded to a command with
:c:macro:`casio_seven_err_overwrite`, the active device sends the
passive device an acknowledge packet with such a subtype to confirm
the overwrite.
.. c:macro:: casio_seven_ack_ext
Respond to a discovery command with device information.
.. c:macro:: casio_seven_ack_term
Used to acknowledge a terminate packet.
There also are several terminate types:
.. c:type:: casio_seven_term_t
The terminate type is the reason why the connection was terminated:
.. c:macro:: casio_seven_term_default
Normal termination.
.. c:macro:: casio_seven_term_user
The user has terminated the connection (by pressing AC on the
calculator, usually).
.. c:macro:: casio_seven_term_timeouts
Terminated due to timeouts or checksums.
.. c:macro:: casio_seven_term_overwrite
In response to ``ow_terminate``.
|