Sie sind auf Seite 1von 26

LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
LEGO, the LEGO logo, MlNDS1OPMS and the MlNDS1OPMS logo are trademarks of the LEGO Group
2006 1he LEGO Group
Other product and company names listed are trademarks or trade names of their respective companies.
version. I.00

LEGO
O
MINDS1ORMS
O
NX1
ARM7 BIuetooth
O

Interface Specification




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 2
version. I.00
1ABLE OF CON1EN1S

TABLE OF CONTENTS......................................................................................................2
HARDWARE INTERFACE..................................................................................................4
Control signals .............................................................................................................................................................. 4
SPI interface.................................................................................................................................................................. 4
UART interface............................................................................................................................................................. 4
UART INTERFACE STATES ..............................................................................................5
Stream mode.................................................................................................................................................................. 5
VM Command mode .................................................................................................................................................... 5
COMMAND MESSAGES BETWEEN BLUECORE
TM
& ARM7 ..........................................6
Message diagram .......................................................................................................................................................... 6
BlueCore
TM
state diagram............................................................................................................................................ 7
OPERATING MODES .........................................................................................................8
STREAM_BREAKING_MODE................................................................................................................................. 8
DONT_BREAK_STREAM_MODE........................................................................................................................... 8
COMMAND MESSAGE CODING .......................................................................................9
Message structure ......................................................................................................................................................... 9
Message Wrapping ....................................................................................................................................................... 9
COMMAND MESSAGES (ARM7 => BLUECORE
TM
) .......................................................10
00 BeginInquiry .......................................................................................................................................................... 10
01 CancelInquiry ........................................................................................................................................................ 10
02 Connect ................................................................................................................................................................... 10
03 OpenPort ................................................................................................................................................................ 11
04 LookupName .......................................................................................................................................................... 11
05 AddDevice............................................................................................................................................................... 11
06 RemoveDevice ........................................................................................................................................................ 11
07 DumpList ................................................................................................................................................................ 12
08 CloseConnection..................................................................................................................................................... 12
09 AcceptConnection.................................................................................................................................................. 12
0A PinCode.................................................................................................................................................................. 12
0B OpenStream........................................................................................................................................................... 13
0C StartHeart.............................................................................................................................................................. 13
1C SetDiscoverable ..................................................................................................................................................... 13
1D ClosePort................................................................................................................................................................ 13
21 SetFriendlyName ................................................................................................................................................... 14
23 GetLinkQuality ...................................................................................................................................................... 14
25 SetFactorySettings ................................................................................................................................................. 14
27 GetLocalAddr ........................................................................................................................................................ 14
29 GetFriendlyName................................................................................................................................................... 14
2A GetDiscoverable .................................................................................................................................................... 15
2B GetPortOpen.......................................................................................................................................................... 15
2F GetVersion ............................................................................................................................................................. 15
33 GetBrickStatusbyte................................................................................................................................................ 15
34 SetBrickStatusbyte................................................................................................................................................. 15
35 GetOperatingMode................................................................................................................................................ 16
36 SetOperatingMode................................................................................................................................................. 16
38 GetConnectionStatus ............................................................................................................................................. 16
3A GotoDFUMode ...................................................................................................................................................... 16
RESULT MESSAGES (BLUECORE
TM
=> ARM7) ............................................................17
0D Heartbeat ............................................................................................................................................................... 17




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 3
version. I.00
0E InquiryRunning..................................................................................................................................................... 17
0F InquiryResult ......................................................................................................................................................... 17
10 InquiryStopped ...................................................................................................................................................... 17
11 LookupNameResult ............................................................................................................................................... 18
12 LookupNameFailure.............................................................................................................................................. 18
13 ConnectResult ........................................................................................................................................................ 18
14 ResetIndication....................................................................................................................................................... 18
15 RequestPinCode..................................................................................................................................................... 19
16 RequestConnection................................................................................................................................................ 19
17 ListResult................................................................................................................................................................ 19
18 ListItem................................................................................................................................................................... 20
19 ListDumpStopped.................................................................................................................................................. 20
1A CloseConnectionResult......................................................................................................................................... 20
1B PortOpenResult ..................................................................................................................................................... 21
1E ClosePortResult ..................................................................................................................................................... 21
1F PinCodeAck ........................................................................................................................................................... 21
20 SetDiscoverableAck ............................................................................................................................................... 21
22 SetFriendlyNameAck............................................................................................................................................. 22
24 LinkQualityResult ................................................................................................................................................. 22
26 SetFactorySettingsAck .......................................................................................................................................... 22
28 GetLocalAddrResult.............................................................................................................................................. 22
2C GetFriendlyNameResult ....................................................................................................................................... 23
2D GetDiscoverableResult.......................................................................................................................................... 23
2E GetPortOpenResult............................................................................................................................................... 23
30 GetVersionResult ................................................................................................................................................... 23
31 GetBrickStatusbyteResult..................................................................................................................................... 23
32 SetBrickStatusbyteResult...................................................................................................................................... 24
37 OperatingModeResult ........................................................................................................................................... 24
39 ConnectionStatusResult ........................................................................................................................................ 24
C-CODE STANDARD FOR MESSAGE ID........................................................................25
Enumeration................................................................................................................................................................ 25






LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 4
version. I.00
HARDWARE IN1ERFACE
1he Bluetooth

chip from CSP, named BlueCore


1M
, contains all the necessary hardware to run a
completely self-contained Bluetooth node. A I6-bit integrated processor runs the B1-Stack
implementation from CSP called BlueLab. 1his firmware integrates a user programmable vM-task
enabling us to control the B1 node and run small amounts of application code. We have integrated a
command interpreter in the vM that decodes and responds to commands received through the UAP1.

Our vM-code is a full implementation of both the B1 SPP-A and SPP-B profiles. 1he two SPP profiles
differ in the way a connection is established with remote B1-nodes. SPP-A is used when the local
BlueCore
1M
chip is the connection initiator while SPP-B is used when the remote node initiates the
connection.

BlueCore
1M
uses stream mode to exchange data at a rate of <= 220K baud after a connection is
established. 1his effectively emulates a serial cable between the two connected B1-nodes. 1he UAP1
is used in both stream mode and command mode (which is used to control the vM application within
BlueCore
1M
and by extension, the Bluetooth functionality within the NX1).
1he state of the UAP1 channel is controlled by two interface signals (APM7_CMD & BC4_CMD). 1he
program runs on BlueLab version 3.2.

1he main NX1 processor that controls our user interface provides drivers for peripherals and runs user
code.
CON1ROL SIGNALS
Peser. Active low signal initiated by the APM7 that resets the BlueCore
1M
chip.
APV7_CVD. Active high signal that signals the state of the UAP1 channel seen from the APM7. lnput
at BlueCore
1M
PlO(II).
BC4_CVD. Active high signal that signals the state of the UAP1 channel seen from BlueCore
1M
.
Output at BlueCore
1M
PlO(I0).

For further details, see the UAP1 lnterface States section below.
SPI IN1ERFACE
1he SPl enables firmware updates of the BlueCore
1M
chip through CSP's DFU-algorithm. 1he SPl signals
are shared with the display (except for the active low control signal).
UAR1 IN1ERFACE
High-speed full-duplex interface with handshake signals (P1S & C1S).

UAP1 settings used both in stream and command modes.

460.8K Baud
8 Bit
No Parity
One stop bit




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 5
version. I.00
UAR1 IN1ERFACE S1A1ES
S1REAM MODE
BlueCore
1M
is fully transparent although it is controlled by UAP1 in stream mode. lt is, therefore, up to
the higher firmware-levels running in the APM7 and the remote node to pack, unpack, and interpret the
data.
VM COMMAND MODE
Command mode is initiated by request from either the APM7 or BlueCore
1M
chips. All data is packed,
unpacked, and interpreted in accordance with the protocol definition.

State transitions
Below is shown how the APM7 transitions the BlueCore
1M
chip and the UAP1 interface from stream
mode to command mode and back and vice-versa.

I. Create stream connection
lNl1. BC4_CMD low and APM_CMD low
APM. OpenStream
BC4. Open stream APM-~PADlO
BC4. Set BC4_CMD high
APM. Set APM_CMD high
BC4. Open stream PADlO-~APM

2. BC4 closes stream
lNl1. BC4_CMD high and APM_CMD high
BC4. Close stream PADlO-~APM
BC4. Set BC4_CMD low
APM. Set APM_CMD low
BC4. Close stream APM-~PADlO
BC4. Send 1elegram

3. APM close stream
lNl1. BC4_CMD high and APM_CMD high
APM. Set APM_CMD low
BC4. Close stream PADlO-~APM
BC4. Close stream APM-~PADlO
BC4. Set BC4_CMD low
APM. Send 1elegram




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 6
version. I.00
COMMAND MESSAGES BE1WEEN BLUECORE
1M
& ARM7
Known Bluetooth addresses and their user-friendly names are stored in the BlueCore
1M
chip, enabling
fast connections.

Figures I and 2 below show message and state diagrams for command messages sent between the
BlueCore
1M
and APM7 processors. All of the command messages and their respective replies are
described in further detail later in this document.

MESSAGE DIAGRAM
UART Handler Command Dispatcher
nquiry Manager
Connection Manager
List of Known Devices
Heartbeat()
Heart
PO Handler
nquiryRunning()
nquiryResult (bd_addr, name)
nquiryStopped()
LookupNameResult (bd_addr, name)
LookupNameFailure()
ListResult(status)
Listtem(bd_addr, name)
ListDumpStopped()
ConnectResult(status, handle)
RequestPinCode(bd_addr)
RequestConnection(bd_addr)
Send vm-cmd mode request()
Acknowledge vm-mode()
Recieve vm-cmd mode request()
Acknowledge vm-mode()
Connect(bd_addr)
OpenPort()
CloseConnection(handle)
OpenStream(handle)
AcceptConnection(accept)
PinCode(bd_addr, pincode)
Beginnquiry(max, timeout, deviceclass)
LookupName(bd_addr)
Cancelnquiry()
AddDevice(bd_addr, name)
RemoveDevice(bd_addr)
DumpList()
StartHeart()

Figure 1: Block diagram for communication between the BlueCore
TM
and ARM7 processors




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 7
version. I.00
BLUECORE
1M
S1A1E DIAGRAM
Ready Open
Connect
CloseConnection
last open connection
nquiry
Beginnquiry
Timeout /
Max
nquiry
Open
Beginnquiry
Data
PO
OpenStream
Ready
Accepting
Open
Accepting
Connect
CloseConnection
last open connection
nquiry
Accepting
Beginnquiry
Timeout
Max
nquiry
Open and Accepting
Beginnquiry
Timeout
Max
Data
Accepting
PO
Setup Stream
OpenPort
CloseConnection
CloseConnection /
Connect
Decide request
Decide request
Open
AcceptConnection(Reject)
RequestConnection
AcceptConnection(Accept)
RequestConnection
AcceptConnection(Reject)
RequestConnection
RequestConnection
CloseConnection /
Connect
CloseConnection
OpenPort
AcceptConnection(Accept)
VM-CMD-MODE
DLE
STREAM MODE VM-CMD-MODE
Connect
OpenStream
Listening for
Incomming connections
CloseConnection /
Connect
Cancelnquiry
Timeout /
Max
Cancelnquiry
Cancelnquiry
Cancelnquiry
CloseConnection
last open connection
CloseConnection
last open connection
Connect
CloseConnection /
Connect
nitiated by BC4 nitiated by host
Legend
PO
PO
Not Iistening for
Incomming connections

Figure 2: State diagram for communication between the BlueCore
TM
and ARM7 processors




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 8
version. I.00
OPERA1ING MODES
1wo operating modes are defined.
S1PEAM_BPEAKlNG_MODE
DON1_BPEAK_S1PEAM_MODE

1he modes specify how incoming events are handled. Events that should be handled by the
BlueCore
1M
chip include.
connection requests,
pairing requests, and
disconnection

1he operating mode is set using the SetOperatingMode telegram while the current setting can be read
using the GetOperatingMode telegram. 1he setting is saved in the persistent storage and is auto-
applied at start-up. 1he SetFactorySettings telegram also resets this setting.
S1REAM_BREAKING_MODE
ln this mode, an open stream will be closed by the BlueCore
1M
chip in the event of an incoming event.
DON1_BREAK_S1REAM_MODE
ln this mode, the BlueCore
1M
chip will not break any streams unless the connection currently streaming
is closed.




STREAM_BREAKING_MODE DONT_BREAK_STREAM_MODE
Connection request 1) If in stream_mode then break the
stream
2) Send a ConnectionRequest telegram
1) If in stream_mode then reject the
request
2) Else if remote device in device list
then send ConnectionRequest
telegram
3) Else reject the request
Pairing request 1) If in stream_mode then ignore the
request
2) Else send PinCodeRequest telegram
1) If in stream_mode then ignore the
request
2) Else send PinCodeRequest telegram
Disconnection 1) If in stream_mode then break the
stream
2) Send CloseConnectionResult
telegram
1) If in stream_mode with current
stream then close stream and send
CloseConnectionResult telegram
2) Else if in stream_mode then wait for
cmd_mode and send
CloseConnectionResult
3) Else send CloseConnectionResult





LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 9
version. I.00
COMMAND MESSAGE CODING
MESSAGE S1RUC1URE
Encoding and decoding of command mode telegrams is handled at byte level. 1his is necessary
because of the different interpretation of variables longer than 8 bits by the two processors. 1he two
also use different endians. APM7 uses little endian and BlueCore
1M
big endian.
MESSAGE WRAPPING
lLengthlMessage typelMessage contentlSUM High bytelSUM Low bytel

Length. Ubyte, Length of the complete telegram (excluding length)
Message type. Ubyte, Defined by enumeration of all message types
Message content. Defined for each message in the entries below
SUM. UintI6, Negated sum of all previous bytes =~ Message lD + Message content + SUM =
0





LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I0
version. I.00
COMMAND MESSAGES (ARM7 => BLUECORE
1M
)
00 BEGININOUIRY
Parameters. uint8 max_devices, uintI6 timeout, uint32 class_of_device
ln reply to. None
Peturn messages. lnquiryPunning, lnquiryPesult and lnquiryStopped

1his command starts the inquiry process. lt is acknowledged by an lnquiryPunning message from the
BlueCore
1M
chip. 1he inquiry can be cancelled by sending a Cancellnquiry message. 1he parameters
are transferred directly to the corresponding parameters of the BlueLab inquiry command. 1he
following is copied from the BlueLab documentation.
1he time the inquiry is performed for is in fact timeout I.28 seconds. 1he allowed values of timeout
are in the range 0x0I to 0x30. 1his corresponds to an inquiry timeout range of I.28 to 6I.44 seconds.

For every device found, an lnquiryPesult message is sent to the host. 1he inquiry will run until
max_devices devices have been found or timeout is reached. An lnquiryStopped message indicates
that the inquiry has ended. Switching to stream mode will cancel inquiry without indication.

1elegram.
l I0 l MSG_Beginlnquiry l max_devices l timeout [Hi] l timeout[Lo] l class_of_device[hi] l
class_of_device[hi-I] l class_of_device[hi-2] l class_of_device[lo] l SUM[Hi] l SUM[Lo] l
0! CANCELINOUIRY
Parameters. None
ln reply to. None
Peturn messages. lnquiryStopped

1his command stops the inquiry process. lt is acknowledged by an lnquiryStopped message from the
BlueCore
1M
chip. lt cannot be guaranteed that no lnquiryPesult messages will be sent between the
Cancellnquiry and the lnquiryStopped message but they will be kept at a minimum. Switching to
stream mode will cancel inquiry without indication.

1elegram.
l 3l MSG_Cancellnquiry l SUM[Hi] l SUM[Lo] l
02 CONNEC1
Parameters. bdaddr device_address
ln reply to. None
Peturn messages. ConnectPesult, PequestPinCode

1his message indicates to the BlueCore
1M
chip that the host wants to connect to a remote device. 1he
parameter specifies the Bluetooth device address of the remote device. ln reply to this message a
ConnectPesult message is returned indicating the success or failure of the connect operation. After a
successful operation an OpenStream message can be used to switch to stream mode. 1o close a
connection the host can send a CloseConnection message.

1elegram.
l I0l MSG_Connect l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l bdaddr.uap l
bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group II
version. I.00
03 OPENPOR1
Parameters None
ln reply to. None
Peturn messages. OpenPortPesult

1o begin accepting connections from the outside, send this message to the BlueCore
1M
chip. 1his
command is acknowledged by an OpenPortPesult message indicating success or failure. After a
successful operation, the BlueCore
1M
chip can send PequestConnection messages. Sending a
ClosePort message to the BlueCore
1M
chip closes the port.

1elegram.
l 3l MSG_OpenPort l SUM[Hi] l SUM[Lo] l
04 LOOKUPNAME
Parameters. bdaddr device_address
ln reply to. None
Peturn messages. LookupNameFailure and LookupNamePesult

1ells the BlueCore
1M
chip to look up and return the friendly name of a remote device. 1he result of this
command will be returned in a LookupNamePesult message or in case of failure, a LookupNameFailure.

1elegram.
l I0l MSG_LookupName l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l
05 ADDDEVICE
Parameters. bdaddr device_address, char [I6] name, uint32 class_of_device
ln reply to. None
Peturn messages. ListPesult

Adds or updates a device entry in the list of known devices. A ListPesult message indicates success or
failure of the operation.

1elegram.
l 30 l MSG_AddDevice l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l bdaddr.uap
l bdaddr.nap[Hi] l bdaddr.nap[Lo] l char [I6] name l class_of_device[hi] l class_of_device[hi-I] l
class_of_device[hi-2] l class_of_device[lo] l SUM[Hi] l SUM[Lo] l
06 REMOVEDEVICE
Parameters. bdaddr device_address
ln reply to. None
Peturn messages. ListPesult

1his message can be sent to erase a device from the list of known devices. A ListPesult message
acknowledges the operation.

1elegram.
l I0l MSG_PemoveDevice l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I2
version. I.00
07 DUMPLIS1
Parameters. None
ln reply to. None
Peturn messages. Listltem and ListDumpStopped

Send this message to retrieve the list of known devices. 1he items on the list will be sent one by one in
Listltem messages. When the last item has been sent, a ListDumpStopped message is sent.

1elegram.
l 3l MSG_DumpList l SUM[Hi] l SUM[Lo] l
08 CLOSECONNEC1ION
Parameters. uint8 handle
ln reply to. None
Peturn messages. CloseConnectionPesult

1his message closes a connection an active connection or an open port. 1he handle is given by a
ConnectPesult message sent to the host in reply to Connect messages. 1he success or failure of the
command is returned in a CloseConnectionPesult message.

1elegram.
l 4l MSG_CloseConnection l handle l SUM[Hi] l SUM[Lo] l
09 ACCEP1CONNEC1ION
Parameters. uint8 accept
ln reply to. PequestConnection
Peturn messages. ConnectPesult and PequestPinCode

1his message is used to indicate whether the BlueCore
1M
chip should accept an incoming connection.
1he message should be sent in reply to a PequestConnection message. 1he accept parameter should
be set to I if the connection is accepted and 0 if it is not. A ConnectPesult or PequestPinCode
message will be sent in response to this message.

1elegram.
l 4l MSG_AcceptConnection l accept l SUM[Hi] l SUM[Lo] l
0A PINCODE
Parameters. bdaddr bd_addr, char [I6] pin_code
ln reply to. PequestPinCode
Peturn messages. PinCodeAck

1his message is used to send a pin code entered by the user on to the BlueCore
1M
chip. 1his message
should be used in response to a PequestPinCode message. 1he pin_code parameter is to be null-
terminated if the pin_code is shorter than I6 chars. lf none of the I6 chars is null, the pin code is
assumed to be I6 chars long.

1elegram.
l 26l MSG_PinCode l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l bdaddr.uap l
bdaddr.nap[Hi] l bdaddr.nap[Lo] l char [I6], pin_code l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I3
version. I.00
0B OPENS1REAM
Parameters. uint8 handle
ln reply to. None
Peturn messages. A switch to stream mode is signaled on the PlO-pins

1his message will set up a stream to the connection indicated by the handle parameter. After this call,
the UAP1 will go into stream mode. 1he only way to break stream mode is to signal on the PlO-pins. lf
the call fails, we are in trouble. 1he host should reset the BlueCore
1M
chip after a timeout period. Note
that this call cancels a running inquiry.

1elegram.
l 4l MSG_OpenStream l handle l SUM[Hi] l SUM[Lo] l
0C S1AR1HEAR1
Parameters. None
ln reply to. None
Peturn messages. Heartbeat

1his message indicates that the host wants to receive heartbeat signals. 1he Heartbeat message will
be sent in reply and again every time the UAP1 has been idle for X msec.

1elegram.
l 3l MSG_StartHeart l SUM[Hi] l SUM[Lo] l
!C SE1DISCOVERABLE
Parameters. uint8 visible
ln reply to. None
Peturn messages. SetDiscoverableAck

1his message will enable or disable inquiry scanning. lf the visible parameter is set to I, the BlueCore
1M
chip will answer incoming inquiries. lf visible is set to 0, the BlueCore
1M
chip will not answer, rendering
the BlueCore
1M
chip invisible to inquiries. 1his does not affect the ability to accept incoming
connections.

1elegram.
l 4l MSG_SetDiscoverable l visible l SUM[Hi] l SUM[Lo] l
!D CLOSEPOR1
Parameters. uint8 handle
ln reply to. None
Peturn messages. ClosePortPesult

1his message will close the port. Until it is removed, the handle should always be 03.

1elegram.
l 4 l MSG_ClosePort l handle l SUM[Hi] l SUM[Lo] l







LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I4
version. I.00
2! SE1FRIENDLYNAME
Parameters. char [I6] name
ln reply to. None
Peturn messages. SetFriendlyName Ack

1his message is used to set the friendly name of the local device. 1he name parameter is to be null-
terminated if the name is shorter than I6 chars. lf none of the I6 chars is null, the name is assumed to
be I6 chars long.

1elegram.
l I9 l MSG_SetFriendlyName l char [I6] name l SUM[Hi] l SUM[Lo] l
23 GE1LINKOUALI1Y
Parameters. uint8 handle
ln reply to. None
Peturn messages. LinkQualityPesult

1his message requests a reading of the HCl link quality of a connection.

1elegram.
l 4l MSG_GetLinkQuality l handle l SUM[Hi] l SUM[Lo] l
25 SE1FAC1ORYSE11INGS
Parameters. None
ln reply to. None
Peturn messages. SetFactorySettingsAck

1his message is sent to clear the settings in the persistent storage. 1he BlueCore
1M
chip should be
restarted after calling this function. Otherwise old values can be floating around the BlueCore
1M
chip
causing unexpected behavior.

1elegram.
l 3l MSG_SetFactorySettings l SUM[Hi] l SUM[Lo] l
27 GE1LOCALADDR
Parameters. None
ln reply to. None
Peturn messages. GetLocalAddrPesult

1his message will fetch the local Bluetooth device address.

1elegram.
l 3l MSG_GetLocalAddr l SUM[Hi] l SUM[Lo] l
29 GE1FRIENDLYNAME
Parameters. None
ln reply to. None
Peturn messages. GetFriendlyNamePesult

1his message will fetch the friendly name of the local Bluetooth device.

1elegram.
l 3l MSG_GetFriendlyName l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I5
version. I.00
2A GE1DISCOVERABLE
Parameters. None
ln reply to. None
Peturn messages. GetDiscoverablePesult

1his message will fetch the status of the discoverable local Bluetooth devices.

1elegram.
l 3l MSG_GetDiscoverable l SUM[Hi] l SUM[Lo] l
2B GE1POR1OPEN
Parameters. None
ln reply to. None
Peturn messages. GetPortOpenPesult

1his message will fetch the status of the local Bluetooth device port.

1elegram.
l 3l MSG_GetPortOpen l SUM[Hi] l SUM[Lo] l
2F GE1VERSION
Parameters. None
ln reply to. None
Peturn messages. GetversionPesult

1his message will fetch the version of the BlueCore
1M
code.

1elegram.
l 3l MSG_GetversionOpen l SUM[Hi] l SUM[Lo] l
33 GE1BRICKS1A1USBY1E
Parameters. None
ln reply to. None
Peturn messages. GetBrickStatusbytePesult

1his message will fetch the status bytes from persistent storage.

1elegram.
l 3l MSG_GetBrickStatusbyte l SUM[Hi] l SUM[Lo] l
34 SE1BRICKS1A1USBY1E
Parameters. uint8 byteI, uint8 byte2
ln reply to. None
Peturn messages. SetBrickStatusbytePesult

1his message set the status bytes in the persistent storage.

1elegram.
l 5l MSG_SetBrickStatusbyte l byteI l byte2 l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I6
version. I.00
35 GE1OPERA1INGMODE
Parameters. None
ln reply to. None
Peturn messages. OperatingModePesult

1his message gets the operating mode of the brick. See 36 SetOperatingMode for a description of
the modes.

1elegram.
l 3 l MSG_GetOperatingMode l SUM[Hi] l SUM[Lo] l
36 SE1OPERA1INGMODE
Parameters. uint8 mode
ln reply to. None
Peturn messages. OperatingModePesult

1his message sets the operating mode of the brick. 1he mode should be one of.

typedef enum (
S1PEAM_BPEAKlNG_MODE,
DON1_BPEAK_S1PEAM_MODE
l OperatingMode,

1elegram.
l 4l MSG_SetOperatingMode l mode l SUM[Hi] l SUM[Lo] l
38 GE1CONNEC1IONS1A1US
Parameters. None
ln reply to. None
Peturn messages. ConnectionStatusPesult

1his message gets the connection status of the brick.

1elegram.
l 3 l MSG_GetConnectionStatus l SUM[Hi] l SUM[Lo] l
3A GO1ODFUMODE
Parameters. None
ln reply to. None
Peturn messages. None

1his message will cause a warm reboot into DFU boot mode.

1elegram.
l 3 l MSG_GotoDFUMode l SUM[Hi] l SUM[Lo] l





LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I7
version. I.00
RESUL1 MESSAGES (BLUECORE
1M
=> ARM7)
0D HEAR1BEA1
Parameters. None
ln reply to. StartHeart, and a BlueCore
1M
initiated mode shift to command mode
Peturn messages. None

After a StartHeart message is sent, this message is sent periodically. See the description of the
StartHeart message for details.

1elegram.
l 3l MSG_Heartbeat l SUM[Hi] l SUM[Lo] l
0E INOUIRYRUNNING
Parameters. None
ln reply to. Beginlnquiry
Peturn messages. None

Sent as acknowledgement of a Beginlnquiry message. 1his message will be followed by zero or more
lnquiryPesult messages and lastly by an lnquiryStopped message.

1elegram.
l 3l MSG_lnquiryPunning l SUM[Hi] l SUM[Lo] l
0F INOUIRYRESUL1
Parameters. bdaddr device_address, char [I6] name, uint32 class_of_device
ln reply to. Beginlnquiry
Peturn messages. None

For each device found in an inquiry, this message is sent from the BlueCore
1M
to the host. 1he
message contains the device address of the device and the friendly name. lf the friendly name is less
than I6 chars long, the string is null-terminated, otherwise it is assumed to be I6 chars long. 1he
class_of_device parameter contains the device class identifier as specified in the Bluetooth
specifications.

1elegram.
l 30 l MSG_lnquiryPesult l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l char [I6], name l class_of_device[hi] l
class_of_device[hi-I] l class_of_device[hi-2] l class_of_device[lo] l SUM[Hi] l SUM[Lo] l
!0 INOUIRYS1OPPED
Parameters. None
ln reply to. Beginlnquiry
Peturn messages. None

1his message indicates that an inquiry has ended. 1his may be because a timeout or that the maximum
number of found devices has been reached. An inquiry will also end if the UAP1 enters stream mode
but this will not generate an lnquiryStopped message.

1elegram.
l 3l MSG_lnquiryStopped l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I8
version. I.00
!! LOOKUPNAMERESUL1
Parameters. bdaddr device_address, char [I6] name, uint32 class_of_device
ln reply to. LookupName
Peturn messages. None

1his message is sent in response to a LookupName command message. 1he message contains the
device address and the friendly name of the device. lf the friendly name is less than I6 chars long, the
string is null-terminated, otherwise it is assumed to be I6 chars long.

1he class of device is read from the device list. lf the device is not on the list, zero is returned.

1elegram.
l 30l MSG_LookupNamePesult l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l char [I6], name l class_of_device[hi] l
class_of_device[hi-I] l class_of_device[hi-2] l class_of_device[lo] l SUM[Hi] l SUM[Lo] l
!2 LOOKUPNAMEFAILURE
Parameters. bdaddr device_address
ln reply to. LookupName
Peturn messages. None

1his message is sent as response to a LookupName command message in case of failure.

1elegram.
l I0 l MSG_LookupNameFailure l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l
!3 CONNEC1RESUL1
Parameters. uint8 status, uint8 handle
ln reply to. Connect and OpenPort
Peturn messages. None

1his message is sent in response to Connect and OpenPort messages. 1he status parameter is I if the
Connect or OpenPort operation was a success and 0 if it is not.

1elegram.
l 5l MSG_ConnectPesult l status l handlel SUM[Hi] l SUM[Lo] l
!4 RESE1INDICA1ION
Parameters. None
ln reply to. None
Peturn messages. None

1his message is sent to the host when the BlueCore
1M
chip is finished with its initialization.

1elegram.
l 3l MSG_Pesetlndication l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group I9
version. I.00
!5 REOUES1PINCODE
Parameters. bdaddr device_address
ln reply to. None
Peturn messages. PinCode

1his message is sent if a remote device is requesting a pin code. 1he host should prompt the user for a
pin code and return it in a PinCode message. 1he device_address parameter contains the device
address of the remote device.

1elegram.
l I0l MSG_PequestPinCode l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l
!6 REOUES1CONNEC1ION
Parameters. bdaddr device_address
ln reply to. None
Peturn messages. AcceptConnection

1his message is sent to the host if a remote device wants to connect to the BlueCore
1M
chip. 1he host
should respond by sending an AcceptConnection message indicating whether or not the connection
should be accepted.

1elegram.
l I0l MSG_PequestConnection l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l
!7 LIS1RESUL1
Parameters. uint8 status
ln reply to. AddDevice or PemoveDevice
Peturn messages. None

1he status parameter is given by the following enum.

enum (
LP_SUCCESS = 0x50,
LP_COULD_NO1_SAvE,
LP_S1OPE_lS_FULL,
LP_EN1PY_PEMOvED,
LP_UNKNOWN_ADDP
l,

LP_SUCCESS. lndicates that the operation was successful.
LP_COULD_NO1_SAvE. 1he entry could not be written to persistent storage. 1he BlueCore
1M
chip
must be reset to activate defragmentation of the flash.
LP_S1OPE_lS_FULL. 1here are no empty slots in the list to save an entry to. Use PemoveDevice to
create an open slot.
LP_EN1PY_PEMOvED. 1he entry was successfully removed.
LP_UNKNOWN_ADDP. 1he list does not contain an entry with the provided Bluetooth device address.

1elegram.
l 4l MSG_ListPesult l status l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 20
version. I.00
!8 LIS1I1EM
Parameters. bdaddr device_address, char [I6] name, uint32 class_of_device
ln reply to. DumpList
Peturn messages. None

1his message is sent from the BlueCore
1M
chip to the host for each device found on the list of known
devices. 1he message contains the device address of the device and the friendly name. lf the friendly
name is less than I6 chars long the string is null-terminated, otherwise it is assumed to be I6 chars long.

1elegram.
l 26l MSG_Listltem l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l bdaddr.uap l
bdaddr.nap[Hi] l bdaddr.nap[Lo] l char [I6] name l class_of_device[hi] l class_of_device[hi-I] l
class_of_device[hi-2] l class_of_device[lo] l SUM[Hi] l SUM[Lo] l
!9 LIS1DUMPS1OPPED
Parameters. None
ln reply to. DumpList
Peturn messages. None

1his message indicates that the list dump was completed.

1elegram.
l 3l MSG_ListDumpStopped l SUM[Hi] l SUM[Lo] l
!A CLOSECONNEC1IONRESUL1
Parameters. uint8 status, uint8 handle
ln reply to. CloseConnection
Peturn messages. None

1his message is sent in response to CloseConnection messages. 1he status parameter is given by the
following enum.

typedef enum
(
/! Successful disconnection./
spp_disconnect_success,
/! Unsuccessful due to the link being lost./
spp_disconnect_link_loss,
/! Unsuccessful due to no service level connection./
spp_disconnect_no_slc,
/! Unsuccessful due to time out./
spp_disconnect_timeout,
/! Unsuccessful for some other reason./
spp_disconnect_error
l spp_disconnect_status,

1elegram.
l 5l MSG_CloseConnectionPesult l status l handle l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 2I
version. I.00
!B POR1OPENRESUL1
Parameters. uint8 status, uint8 handle, uint8 ps_success
ln reply to. OpenPort
Peturn messages. None

1his message is the result of a PortOpen command. lt will contain the status I if successful and 0
otherwise. Ps_Success is 0 if the port-open could not be written to persistent storage and I if it could.
1he port will be opened regardless of the persistent storage.

1elegram.
l 6 l MSG_PortOpenPesult l status l handle l ps_success l SUM[Hi] l SUM[Lo] l
!E CLOSEPOR1RESUL1
Parameters. uint8 status, uint8 handle, uint8 ps_sucess
ln reply to. ClosePort
Peturn messages. None

1his message is the result of an CloseOpen command. lt will contain the status I if successful and 0
otherwise. Ps_Success is 0 if the port-close could not be written to persistent storage and I if it could.
1he port will be closed regardless of the persistent storage.

1elegram.
l 6 l MSG_ClosePortPesult l status l handle l ps_success l SUM[Hi] l SUM[Lo] l
!F PINCODEACK
Parameters. None
ln reply to. PinCode
Peturn messages. None

1his message is sent after a PinCode message is received. See the description of the PinCode
telegram for details.

1elegram.
l 3 l MSG_PinCodeAck l SUM[Hi] l SUM[Lo] l
20 SE1DISCOVERABLEACK
Parameters. uint8 success
ln reply to. SetDiscoverable
Peturn messages. None

1his message is sent after a SetDiscoverable message is received. See the description of the
SetDiscoverable telegram for details. Success is 0 if the name could not be written to persistent
storage and I if it could. 1he discoverability will be changed regardless of the persistent storage.

1elegram.
l 3l MSG_SetDiscoverableAck l success l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 22
version. I.00
22 SE1FRIENDLYNAMEACK
Parameters. uint8 success
ln reply to. SetFriendlyName
Peturn messages. None

1his message is sent after a SetFriendlyName message is received. See the description of the
SetFriendlyName telegram for details. Success is 0 if the name could not be written to persistent
storage and I if it could. 1he name will be changed regardless of the persistent storage.

1elegram.
l 4 l MSG_ SetFriendlyNameAck l success l SUM[Hi] l SUM[Lo] l
24 LINKOUALI1YRESUL1
Parameters. uint8 quality
ln reply to. GetLinkQuality
Peturn messages. None

1his message contains the result of a GetLinkQuality message. 1he quality is an octet value ranging
from 0x00 to 0xFF. lf the value is high, the link quality is better.

1elegram.
l 4l MSG_GetLinkQuality l quality l SUM[Hi] l SUM[Lo] l
26 SE1FAC1ORYSE11INGSACK
Parameters. None
ln reply to. SetFactorySettings
Peturn messages. None

1his message is sent when the settings in the persistent storage have been cleared.

1elegram.
l 3l MSG_SetFactorySettingsAck l SUM[Hi] l SUM[Lo] l
28 GE1LOCALADDRRESUL1
Parameters. bdaddr addr
ln reply to. GetLocalAddr
Peturn messages. None

1his message returns the local Bluetooth device address.

1elegram.
l I0 l MSG_GetLocalAddrPesult l bdaddr.lap[hi] l bdaddr.lap[hi-I] l bdaddr.lap[hi-2] l bdaddr.lap[Lo] l
bdaddr.uap l bdaddr.nap[Hi] l bdaddr.nap[Lo] l SUM[Hi] l SUM[Lo] l




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 23
version. I.00
2C GE1FRIENDLYNAMERESUL1
Parameters. char name[I6]
ln reply to. GetFriendlyName
Peturn messages. None

1his message returns the friendly name of the local Bluetooth device. lf the name is shorter than I6
chars the name will be zero-padded.

1elegram.
l I9 l MSG_GetFriendlyNamePesult l char [I6] l SUM[Hi] l SUM[Lo] l
2D GE1DISCOVERABLERESUL1
Parameters. uint8 discoverable
ln reply to. GetDiscoverable
Peturn messages. None

1he discoverable parameter will be I if the device is discoverable and 0 otherwise.

1elegram.
l 4l MSG_GetDiscoverablePesult l discoverable l SUM[Hi] l SUM[Lo] l
2E GE1POR1OPENRESUL1
Parameters. uint8 portlsOpen
ln reply to. GetDiscoverable
Peturn messages. None

1he portlsOpen parameter will be I if the port is open and 0 otherwise.

1elegram.
l 4l MSG_GetPortOpenPesult l portlsOpen l SUM[Hi] l SUM[Lo] l
30 GE1VERSIONRESUL1
Parameters. uint8 major, uint8 minor
ln reply to. Getversion
Peturn messages. None

1his message contains the version number of the firmware implemented within the BlueCore
1M
chip.

1elegram.
l 5l MSG_GetversionPesult l major l minor l SUM[Hi] l SUM[Lo] l
3! GE1BRICKS1A1USBY1ERESUL1
Parameters. uint8 byteI, uint8 byte2
ln reply to. GetBrickStatusbyte
Peturn messages. None

1his message contains the status bytes from persistent storage.

1elegram.
l 5l MSG_GetBrickStatusbytePesult l byteI l byte2 l SUM[Hi] l SUM[Lo] l





LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 24
version. I.00
32 SE1BRICKS1A1USBY1ERESUL1
Parameters. uint8 success
ln reply to. SetBrickStatusbyte
Peturn messages. None

1he success parameter is given by the following enum, also used in ListPesult.

enum
(
LP_SUCCESS = 0x50,
LP_COULD_NO1_SAvE
l,

LP_SUCCESS. lndicates that the operation was successful.
LP_COULD_NO1_SAvE. 1he entry could not be written to persistent storage. 1he BlueCore
1M
chip
must be reset to activate defragmentation of the flash.

1elegram.
l 3l MSG_SetBrickStatusbytePesult l success l SUM[Hi] l SUM[Lo] l
37 OPERA1INGMODERESUL1
Parameters. uint8 mode
ln reply to. SetOperatingMode, GetOperatingMode
Peturn messages. None

1his message indicates the operating mode of the brick.

1elegram.
l 4l MSG_OperatingModePesult l mode l SUM[Hi] l SUM[Lo] l
39 CONNEC1IONS1A1USRESUL1
Parameters. uint8 status_handle0, uint8 status_handleI, uint8 status_handle2, uint8
status_handle3
ln reply to. GetConnectionStatus
Peturn messages. None

1his message indicates the status of the connection. Each status byte will contain a value in the
enumeration.

typedef enum (
CONN_PEADY,
CONN_lNl1lALlZED,
CONN_CONNEC1ED,
CONN_CONNEC1lNG,
CONN_S1PEAM_OPEN
l ConnState,

1elegram.
l I0 l MSG_ConnectionStatusPesult l3 x PESEPvED l h0 l hI l h2 l h3 l SUM[Hi] l SUM[Lo] l






LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 25
version. I.00
C-CODE S1ANDARD FOR MESSAGE ID
1his enumeration defines the message id numbering. 1he first message type has id 0.
ENUMERA1ION
enum MSG_1YPES
(
MSG_Beginlnquiry,
MSG_Cancellnquiry,
MSG_Connect,
MSG_OpenPort,
MSG_LookupName,
MSG_AddDevice,
MSG_PemoveDevice,
MSG_DumpList,
MSG_CloseConnection,
MSG_AcceptConnection,
MSG_PinCode,
MSG_OpenStream,
MSG_StartHeart,
MSG_Heartbeat,
MSG_lnquiryPunning,
MSG_lnquiryPesult,
MSG_lnquiryStopped,
MSG_LookupNamePesult,
MSG_LookupNameFailure,
MSG_ConnectPesult,
MSG_Pesetlndication,
MSG_PequestPinCode,
MSG_PequestConnection,
MSG_ListPesult,
MSG_Listltem,
MSG_ListDumpStopped,
MSG_CloseConnectionPesult,
MSG_PortOpenPesult,
MSG_SetDiscoverable,
MSG_ClosePort,
MSG_ClosePortPesult,
MSG_PinCodeAck,
MSG_SetDiscoverableAck,
MSG_SetFriendlyName,
MSG_SetFriendlyNameAck,
MSG_GetLinkQuality,
MSG_LinkQualityPesult,
MSG_SetFactorySettings,
MSG_SetFactorySettingsAck,
MSG_GetLocalAddr,
MSG_GetLocalAddrPesult,
MSG_GetFriendlyName,
MSG_GetDiscoverable,
MSG_GetPortOpen,
MSG_GetFriendlyNamePesult,
MSG_GetDiscoverablePesult,
MSG_GetPortOpenPesult,
MSG_Getversion,




LEGO

MlNDS1OPMS

NX1 APM7 Bluetooth

lnterface Specification
2006 1he LEGO Group 26
version. I.00
MSG_GetversionPesult,
MSG_GetBrickStatusbytePesult,
MSG_SetBrickStatusbytePesult,
MSG_GetBrickStatusbyte,
MSG_SetBrickStatusbyte,
MSG_GetOperatingMode,
MSG_SetOperatingMode,
MSG_SetOperatingModePesult,
MSG_GetConnectionStatus,
MSG_ConnectionStatusPesult,
MSG_gotoDFUMode
l,

Das könnte Ihnen auch gefallen