Intermec IF2 Basic Reader Interface Programmer's Reference Manual (BRI version - Page 24

BRI Command Processor, BRI Asynchronous Event Handler, Response Handler

Page 24 highlights

Chapter 2 - Designing Robust BRI Applications BRI Command Processor A BRI Command Processor composes BRI Command strings for the application and sends them to the transport layer. It receives and accumulates BRI Command Response lines until it receives the OK> line marking a complete BRI Command Response. Responses are received in the order in which their corresponding commands were sent. You can parse a normal command response line into data fields by separating the line at each field separator character that is not inside a quoted string. BRI Asynchronous Event Handler A BRI Asynchronous Event Handler must handle all types of BRI Asynchronous Events used by the application. It should quietly discard event types it does not recognize. Response Handler A Response Handler handles all incoming lines by sending: • all lines that start with EVT: to the BRI Asynchronous Event Handler. • all other lines to the BRI Command Processor as command response lines. Programming the BRI Transport Layer When programming the BRI Transport Layer, you need to understand transport operation and initialization. Transport Operation The Transport Layer appends an end-of-line to each outgoing message. It continually monitors the input stream, accumulating complete input lines and sending them to the Message Layer. For serial transport implementations that use message checksums the Transport Layer also adds checksums to outgoing commands and verifies and removes checksums from incoming message lines. The command processor should be notified of transport failure when an incoming checksum is wrong. For details about checksums, see "Using Message Checksums" on page 16. The detailed processing steps of the Transport Layer are: 1 (Optional) Append checksum. This optional step may be used only over a serial connection to a reader. Sum the binary value of the characters in the message, encode the least significant 8 bits of the sum as a two-digit hexadecimal value, and append the two digits to the end of the message. 2 Append end-of-line character. Append a to mark the end of the message in the output stream. 3 Extract lines from input stream. Accumulate input characters until the end-ofline is received, and then send the complete response line to the Response 12 Basic Reader Interface Programmer Reference Manual

  • 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

Chapter 2 — Designing Robust BRI Applications
12
Basic Reader Interface Programmer Reference Manual
BRI Command Processor
A BRI Command Processor composes BRI Command strings for the application and
sends them to the transport layer. It receives and accumulates BRI Command
Response lines until it receives the OK> line marking a complete BRI Command
Response. Responses are received in the order in which their corresponding
commands were sent.
You can parse a normal command response line into data fields by separating the
line at each field separator character that is not inside a quoted string.
BRI Asynchronous Event Handler
A BRI Asynchronous Event Handler must handle all types of BRI Asynchronous
Events used by the application. It should quietly discard event types it does not
recognize.
Response Handler
A Response Handler handles all incoming lines by sending:
all lines that start with EVT: to the BRI Asynchronous Event Handler.
all other lines to the BRI Command Processor as command response lines.
Programming the BRI Transport Layer
When programming the BRI Transport Layer, you need to understand transport
operation and initialization.
Transport Operation
The Transport Layer appends an end-of-line to each outgoing message. It
continually monitors the input stream, accumulating complete input lines and
sending them to the Message Layer.
For serial transport implementations that use message checksums the Transport
Layer also adds checksums to outgoing commands and verifies and removes
checksums from incoming message lines. The command processor should be
notified of transport failure when an incoming checksum is wrong. For details
about checksums, see
“Using Message Checksums” on page 16
.
The detailed processing steps of the Transport Layer are:
1
(Optional) Append checksum. This optional step may be used only over a serial
connection to a reader. Sum the binary value of the characters in the message,
encode the least significant 8 bits of the sum as a two-digit hexadecimal value,
and append the two digits to the end of the message.
2
Append end-of-line character. Append a <CRLF> to mark the end of the message
in the output stream.
3
Extract lines from input stream. Accumulate input characters until the end-of-
line is received, and then send the complete response line to the Response