Download BASIC Programming Guide

Transcript
186
BASIC Programming Guide For Use with CipherLab BASIC Compiler
SPP
Call SET_COM_TYPE (2, 5) to set COM2 to Bluetooth communication.
To initialize Bluetooth SPP Master, call SET_COM (2,4,1,1,1).
To initialize Bluetooth SPP Slave, call SET_COM (2,1,1,1,1).
Call OPEN_COM (2) to initialize the Bluetooth module and set up connection.
Call GET_NET_STATUS (8) to detect if connection is completed. For example,
LOOP003:
IF GET_NET_STATUS(8) = 0 THEN GOTO LOOP003
BEEP(4400,4)
CLS
PRINT "Connect OK"
Call WRITE_COM (2) and READ_COM$ (2) to transmit and receive data respectively.
Call GET_NET_STATUS (8) to detect if connection is maintained. For example,
IF GET_NET_STATUS(8) = 0 THEN
BEEP(3300,4)
CLOSE_COM(2)
END IF
Call CLOSE_COM (2) to terminate communication and shut down the Bluetooth
module.
Wedge Emulator via SPP
Instead of making use of the keyboard wedge interface, the “Serial to Keyboard
Converter” program lets users convert data to keyboard input via Bluetooth SPP in
general wedge functions, such as SEND_WEDGE, SET_WEDGE, and
WEDGE_READY. That is, users can upgrade a normal wedge application to a
“wireless” wedge application.
Refer to section 5.9.3 Wedge Emulator.
The “Serial to Keyboard Converter” program helps develop a keyboard key in
application without any serial port input function. It supports multiple regions, i.e.,
an application can make use of this tool for varying keyboard layout.
All you need to do is to modify a few codes as shown below.
Note: Alternatively, you may apply Bluetooth HID for wedge application on the
Bluetooth-enabled terminals.