Melody 5.7 Manual

Add to my manuals
81 Pages

advertisement

Melody 5.7 Manual | Manualzz

Melody 6.0.33

Appendix C: Examples

These are some typical use case example.

In every one of them we assume that the pairing list is empty and the configuration is the default one.

> UNPAIR

>OK

> RESTORE

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

Melody 6.0.33

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 53 of 81

Melody 6.0.33

Melody 6.0.33

1. Pairing and connection with Melody

Discovering Melody from a phone and initiating paring:

Use the STATUS command to make sure that Melody is discoverable, if it is not the case you can use the

DISCOVERABLE command:

> DISCOVERABLE ON

>OK

> STATUS

>STATE CONNECTABLE DISCOVERABLE

Now look for devices from your mobile phone. Your device should appear with the configured name (see

NAME parameter). Select and initiate pairing with Melody. This should automatically connect the phone to

Melody with all available profiles.

Melody will respond with a status OPEN_OK/OPEN_ERROR for each opened profiles.

Discovering a phone from Melody and connect to it:

Make sure Bluetooth is ON and your phone is discoverable if you want to it to be visible to Melody.

Use the INQUIRY command to look for discoverable devices. Melody will return a list of discoverable device:

When you find the correct device, take note of its Bluetooth address and use the OPEN command to connect to the device. Melody will respond with a status OPEN_OK/OPEN_ERROR for each opened profiles.

> INQUIRY 10

>INQUIRY {BT ADDRESS}{NAME}{DEVICE CLASS}{RSSI}

> OPEN {BT ADDRESS} {PROFILE}

>PAIR_PENDING

>PAIR_OK {BT ADDRESS}

>OPEN_OK 10 A2DP

Please note that if you want to connect Melody to a new device, Melody will go automatically in discoverable mode to be able to pair with the new device. Once paired, the device will be added to paired device list (use

LIST command to see it) and Melody will be able to connect directly to it.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 54 of 81

Melody 6.0.33

Melody 6.0.33

2. SPP

The following section describes a typical use case for an SPP connection. In this example, we create a SPP connection between two Melody devices to show some of the capabilities of the SPP profile from the transmitter and receiver side.

First you must assure that the SPP profile is enabled on both devices:

Melody SPP Device One

// Enable SPP

> SET PROFILES=X X X X X X 1 X X X X X

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

Melody SPP Device Two

// Enable SPP

> SET PROFILES=X X X X X X 1 X X X X X

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

The next step is to create an SPP connection, in this example, the OPEN command is used:

Melody SPP Device One

//Start connection

> OPEN {BT ADDRESS} SPP

>OPEN_OK 15SPP

Melody SPP Device Two

//Accepts connection

>OPEN_OK 15 SPP

We can type status on both devices to see the details of the SPP connection:

Melody SPP Device One Melody SPP Device Two

//Get connection details

> STATUS

>LINK 15 CONNECTED SPP {BT ADDRESS}

COMMAND

//Get connection details

> STATUS

>LINK 15 CONNECTED SPP {BT ADDRESS}

COMMAND

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 55 of 81

Melody 6.0.33

Melody 6.0.33

So, in both devices, we are in command mode. In this mode, we can use the SEND command as follows to send a string from device one to device two:

Melody SPP Device One

//Sends a string to device two.

> SEND 15 Hi, I’m device one.

>OK

Melody SPP Device Two

//Device two prints a notification with the SPP link, the length of the received data and the data.

>RECV 15 19 Hi, I’m device one. or we can use the SEND_RAW command to transfer a specified number of bytes:

Melody SPP Device One Melody SPP Device Two

// Use the SEND command to send 20 bytes of data through the SPP connection.

> SEND_RAW 15 20

>OK

// The next 20 bytes we send through the UART interface, will be sent through the SPP connection to device two.

>012345678901234567890

// Device one has already received 20 characters, so send to the data to device two.

// Do nothing in device two.

// Do nothing in device two.

// Device two receives the 20 bytes.

>RECV 15 20 01234567890123456789

If device two is in command mode, we can also execute commands in device two from device one, by sending the command we want to execute through the SPP connection. This is currently not supported for all commands.

Melody SPP Device One Melody SPP Device Two

// Execute the status command in device two and obtain the results.

> SEND_RAW 15 7

>OK

// Send the status command, <CR> is the carriage return character.

// Do nothing in device two.

//Device two, which is in command mode, receives the status command and

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 56 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

>STATUS<CR>

// Device one prints the results from executing the status command in device two.

>RECV 15 15 STATE CONNECTED

>RECV 15 4 OFF

>RECV 15 54 LINK 15 CONNECTED

{BT_ADDRESS} COMMAND STRING

executes it, then it sends the results through the SPP connection.

// Do nothing in device two.

Now we will use data mode in device one, but first the user must assure that hardware flow control in the

UART interface is enabled.

Melody SPP Device One Melody SPP Device Two

// Get the UART configuration, which shows that HW flow control is enabled.

> GET UART_CONFIG

>UART_CONFIG=9600 ON 0

// Do nothing in device two.

When data mode is enabled, data received from the UART interface is sent through the SPP interface with no additional parsing, and, similarly, data received from the SPP connection is sent through the UART interface.

Melody SPP Device One Melody SPP Device Two

// Enable data mode.

> ENTER_DATA_MODE 15

>OK

//Data received from the UART interface is immediately sent through the SPP connection.

> Hi I’m device one.

// Data received from the SPP connection is immediately sent through the UART.

>

Hi, I’m device two.

// Do nothing in device two.

// Device two receives the data sent from device one.

>RECV 15 1 H

>RECV 15 18 I, I’m device one.

// Send something from device two to device one.

> SEND 15 Hi, I’m device two.

>OK

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 57 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

To exit from data mode, you can use the escape sequence:

Melody SPP Device One Melody SPP Device Two

// Follow the procedure to exit from data mode using the escape sequence.

> $$$$

>OK

// Device two is no longer in data mode.

// Do nothing in device two.

// Do nothing in device two.

Finally, you can use the CLOSE command to terminate an SPP connection, in this example, we will use the close command in device one:

Melody SPP Device One Melody SPP Device Two

// Follow the procedure to exit from data mode using the escape sequence.

> CLOSE 15

>CLOSE_OK 15 SPP

//Device two confirms that the SPP has closed successfully.

>CLOSE_OK 15 SPP

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 58 of 81

Melody 6.0.33

Melody 6.0.33

3. AGHFP & HFP

In this section we will connect two Melody devices to show some of the capabilities of the HFP profile.The examples in this section assume that wideband and in-band ringing is enabled, although they are also applicable for other scenarios.

First, we enable AGHFP in the device acting as an Audio Gateway and HFP in the device acting as a handsfree device, using the profiles configuration.

Melody AG Melody HF

// Enable HFP

> SET PROFILES=0 1 X X X X X X X X X X

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

// Enable AGHFP

>

>

>

SET PROFILES=1 0 X X X X X X X X X X

>OK

WRITE

>OK

RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

The next step is to create an HFP connection between the two devices, we can achieve this in two different ways, either from the device with the HFP profile enabled opening a HFP connection or from the device with the AGHFP enabled opening an AGHFP connection. In this example, we create a connection from the AGHFP device: TODO: HFP codec variable only updates after an audio connection .

Melody AG Melody HF

//Open a connection from the AGHFP.

> OPEN {BT ADDRESS} AGHFP

>PENDING

successful // AGHFP connection. confirms

>OPEN_OK 12 AGHFP

//Status shows the connection.

> STATUS

>LINK 12 CONNECTED AGHFP {BT ADDRESS}

WB

//HFP is receiving a connection request.

// HFP confirms successful connection.

>OPEN_OK 12 HFP

//Status shows the connection.

> STATUS

>LINK 12 CONNECTED HFP {BT ADDRESS} NB

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 59 of 81

Melody 6.0.33

Melody 6.0.33

From the HFP side, we can notify the AGHFP that we want to establish an outgoing call using the CALL command as follows:

Melody AG Melody HF

// The AG receives notification.

>CALL_REDIAL AGHFP 12

the redial

// The AG receives the call notification along with the memory string.

>CALL_MEMORY AGHFP 12 {MEMORY STRING}

// The AG receives the call notification along with the number.

>CALL_DIAL AGHFP 12 {NUMBER}

// Notify the AG that we want to establish an outgoing call with the last number dialed.

> CALL 13 REDIAL

>OK

// Notify the AG that the HF wants to establish an outgoing call using the following memory string.

> CALL 13 MEMORY {MEMORY STRING}

>OK

// Notify the AG that the HF wants to establish an outgoing call to the following number.

> CALL 13 OUTGOING {NUMBER}

>OK

To initiate an incoming call procedure, we use the CALL command in the AG side:

Melody AG Melody HF

// Start an incoming call procedure.

> CALL 12 INCOMING {NUMBER}

>OK

// We receive the notification that an incoming call is in process.

>CALL_INCOMING AGHFP 12

// Since we have in-band ringing enabled and this is an incoming call, we get periodic in-band ringing notifications.

>INBAND_RING AGHFP 12

//Do nothing in the HF device.

// Receive the notification in the HF side indicating that an incoming call is in progress.

>CALL_INCOMING HFP 13

At this point, we can answer or reject the incoming call. From the HF, we can answer the call using CALL 13

ANSWER or reject the call using CALL 13 REJECT. From the AG we can answer the call using CALL 12

ANSWER or terminate the call using CALL 12 END. In our example, we will answer the call from the HF:

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 60 of 81

Melody 6.0.33

Melody 6.0.33

Melody AG Melody HF

// Do nothing in the AG.

// Receive the notification in the AG side indicating that there is an active call.

>CALL_ACTIVE AGHFP 12

// Answer the incoming call from the

HF.

> CALL 13 ANSWER

>OK

// Receive the notification in the HF side indicating that there is an active call.

>CALL_ACTIVE HFP 13

Since we answered the call from the HF, the audio is transferred through the eSCO/SCO connection. We can modify this behaviour at any time using the transfer command in the AG side:

Melody AG Melody HF

// Perform an audio transfer.

> CALL 12 TRANSFER

>OK

// The audio is now in the AG.

// Perform an audio transfer.

// Do nothing in the HF.

// There is no audio in the HF now.

// Do nothing in the HF.

> CALL 12 TRANSFER

>OK

// There is no audio in the AG now. // The audio is back in the HF.

You can also use the transfer command with the ON_AG or ON_HF parameters. Volume can also be modified while in a call, by default, AG and HF volumes are synchronized, so if you change the volume on one side, the other will synchronize.

Melody AG Melody HF

// Get the volume.

> VOLUME

>12 AGHFP A

>OK

// Modify the volume from the AG.

> VOLUME 12 DOWN

>OK

// Get the volume.

> VOLUME

>13 HFP A

>OK

// Do nothing in the HF.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 61 of 81

Melody 6.0.33

Melody 6.0.33

// Get the volume.

> VOLUME

>12 AGHFP 9

>OK

// Do nothing in the AG.

// Get the volume.

> VOLUME

>12 AGHFP A

>OK

// Get the volume.

> VOLUME

>13 HFP 9

>OK

// Modify the volume from the HF.

> VOLUME 13 UP

>OK

// Get the volume.

> VOLUME

>13 HFP A

>OK

You can end the call using the CALL command in the HF or in the AG. For the HF side, you could use CALL

13 END. In our example we terminate the call from the AG side:

Melody AG Melody HF

// End the call from the AG.

> CALL 12 END

>OK

// The AG side receives a notification

// Do nothing in the HF side.

// The HF receives a notification indicating that the call has been terminated.

>CALL_END AGHFP 12

indicating that there is no call in this link anymore.

>CALL_IDLE HFP 13

Similarly, if we want to initiate an outgoing call procedure, we use the call command as follows:

Melody AG Melody HF

// Initiate an outgoing call procedure.

> CALL 12 OUTGOING {NUMBER}

>OK

// AG gets a notification indicating that an outgoing call is in progress.

>CALL_OUTGOING AGHFP 12

// Do nothing in the HF side.

// The HF receives a notification indicating that there is an outgoing call procedure.

>CALL_OUTGOING HFP 13

At this stage, we can either terminate the call from the HF using CALL 13 END, terminate the call from the AG using CALL 12 END or notify the AG that the remote side has answered the call using CALL 13 ANSWER. In our example, we notify the AG that the remote side has answered the call:

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 62 of 81

Melody 6.0.33

Melody 6.0.33

Melody AG Melody HF

// Notify the AG that the remote side has answered the call.

> CALL 12 ANSWER

>OK

// The AG receives a notification indicating that an active call is in progress.

>CALL_ACTIVE AGHFP 12

// Do nothing in the HF side.

// The HF receives a notification indicating that an active call is in progress.

>CALL_ACTIVE HFP 13

Now that there is an active call, we can use the rest of the commands like in the previous example with the incoming call procedure. In our example, we end the call from the HF:

Melody AG Melody HF

// Do nothing in the AG.

// The AG receives a notification indicating that a call has been terminated.

>CALL_END AGHFP 12

// End the call from the HF.

> CALL 13 END

>OK

// The HF receives a notification indicating that there is no call in the specified link.

>CALL_IDLE HFP 13

Finally, we can close the connection with the CLOSE command from the AG or the HF side.

Melody AG Melody HF

// Close the connection from the AG.

> CLOSE 12

>OK

// Confirm successful disconnection.

>CLOSE_OK 12 AGHFP

// Do nothing in the HF side.

// Confirm successful disconnection.

>CLOSE_OK 13 HFP

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 63 of 81

Melody 6.0.33

Melody 6.0.33

4. PBAP

// Enable PBAP in the profiles

>SET PROFILES=X X X X X X X 1 X X X X

// Open PBAP connection (make sure PBAP is enabled in the PROFILES parameter)

> OPEN {BT ADDRESS} PBAP

>PENDING

>OPEN_OK 16 PBAP

// Download phonebook

> PB_PULL 16

>PENDING

>PB_PULL_START 16

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:My Number

>N;CHARSET=UTF-8:My Number

>TEL;TYPE=CELL:+447446110144

>END:VCARD

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:Acavbsxns

>N;CHAPB_PULL_END 16

>PB_PULL_START 16

>RSET=UTF-8:;Acavbsxns

>TEL;TYPE=CELL:1234 567890

>END:VCARD

>PB_PULL_OK 16

// Download last 10 numbers dialled

> PB_PULL 16 0 3 10 0 85

>PENDING

>PB_PULL_START 16

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:My Number

>N;CHARSET=UTF-8:My Number

>TEL;TYPE=CELL:+447446110144

>X-IRMC-CALL-DATETIME;DIALED:20151110T133324

>END:VCARD

>...

>PB_PULL_OK 16

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 64 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

5. MAP

// Enable MAP in the profiles

>SET PROFILES=X X X X X X X X X X 1 X

// Open MAP connection (make sure MAP is enabled in the PROFILES parameter)

> OPEN {BT ADDRESS} MAP

>PENDING

>OPEN_OK 18 MAP

// Receive a notification and message

>MAP_NEW_SMS 18

>MAP_MSG_BEGIN 18

>BEGIN:BMSG

>VERSION:1.0

>STATUS:UNREAD

>TYPE:SMS_GSM

>FOLDER:telecom/msg/inbox

>NOTIFICATION:1

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:BlueCreation Test

>N;CHARSET=UTF-8:BlueCreation Test

>TEL:

>END:VCARD

>BEGIN:BENV

>BEGIN:BBODY

>CHARSET:UTF-8

>LANGUAGE:UNKNOWN

>LENGTH:45

>BEGIN:MSG

>Hello from bluecreation

>END:MSG

>END:BBODY

>END:BENV

>END:BMSG

>MAP_MSG_END 18

Melody 6.0.33

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 65 of 81

Melody 6.0.33

Melody 6.0.33

6. Music source (A2DP & AVRCP)

To be able to stream music from Melody to a speaker or headset you have to enable A2DP Source.

This can be done by setting up the PROFILES parameter as in the following example:

// Enable A2DP Source and AVRCP (A2DP Sink is disabled)

> SET PROFILES=X X 0 1 1 X X X X X X X

>OK

> WRITE

>OK

> RESET

Melody is now ready to stream some music. Once connected to a device you can use the MUSIC and

VOLUME commands:

> STATE CONNECTABLE DISCOVERABLE OFF

>LINK 10 CONNECTED A2DP {BD ADDRESS} SBC SRC 44100

>LINK 11 CONNECTED AVRCP {BD ADDRESS} STOPPED

> MUSIC 11 PLAY

>OK

>A2DP_STREAM_START 10

>AVRCP_PLAY 11

> VOLUME 11 UP

>OK ABS_VOL 11 87

It is possible send meta data using the AVRCP_META_DATA command:

//notify a track changed and store the meta data

> AVRCP_META_DATA 11 2 BlueCreation

//ARTIST: BlueCreation

>PENDING

//wait for the remote device to send a request to get the new meta data

...

//Melody respond to the remote device with the data previously stored in memory

>OK

16

16

If the remote device is Melody, don't forget to enable meta data to receive the track information

(MUSIC_META_DATA).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 66 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

7. HID

HID Host: note that all HID data is in HEX.

// Enable HID host profile

>SET PROFILES=X X X X X X X X 0 1 X X

>OK

> WRITE

>OK

> RESET

// Read remote device descriptor

>HID_READ {BD ADDRESS}

>PENDING

>HID_READ 0x014F

>{09}{02}{06}{36}{01}{49}{36}{01}{46}{08}{22}{26}{01}{41}{05}{01}{09}{06}{A1}{01}

{85}{01}{75}{01}{95}{08}{05}{07}{19}{E0}{29}{E7}{15}{00}{25}{01}{81}{02}{95}{01}{

75}{08}{81}{03}{95}{05}{75}{01}{05}{08}{19}{01}{29}{05}{91}{02}{95}{01}{75}{03}{9

1}{03}{95}{06}{75}{08}{15}{00}{26}{FF}{00}{05}{07}{19}{00}{29}{FF}{81}{00}{C0}{05

}{0C}{09}{01}{A1}{01}{85}{02}{15}{00}{25}{01}{75}{01}{95}{12}{0A}{23}{02}{0A}{AE}

{01}{0A}{B1}{01}{0A}{94}{01}{0A}{8A}{01}{0A}{82}{01}{0A}{21}{02}{09}{B6}{09}{CD}{

09}{B5}{09}{E2}{09}{EA}{09}{E9}{09}{30}{09}{40}{0A}{96}{01}{0A}{9D}{01}{0A}{C1}{0

1}{81}{02}{95}{01}{75}{06}{81}{03}{C0}{05}{0C}{09}{01}{A1}{01}{85}{03}{05}{01}{09

}{06}{A1}{02}{05}{06}{09}{20}{15}{00}{26}{FF}{00}{75}{08}{95}{01}{81}{02}{C0}{C0}

{05}{01}{09}{80}{A1}{01}{85}{04}{15}{00}{25}{01}{75}{01}{95}{01}{09}{82}{81}{02}{

95}{01}{75}{07}{81}{03}{C0}{05}{0C}{09}{01}{A1}{01}{85}{05}{05}{01}{09}{06}{A1}{0

2}{06}{00}{FF}{25}{01}{75}{01}{95}{02}{0A}{03}{FE}{0A}{04}{FE}{81}{02}{95}{06}{81

}{03}{C0}{C0}{05}{01}{09}{02}{A1}{01}{85}{08}{09}{01}{A1}{00}{05}{09}{19}{01}{29}

{05}{15}{00}{25}{01}{75}{01}{95}{05}{81}{02}{75}{03}{95}{01}{81}{01}{05}{01}{09}{

30}{09}{31}{15}{81}{25}{7F}{75}{08}{95}{02}{81}{06}{09}{38}{15}{81}{25}{7F}{75}{0

8}{95}{01}{81}{06}{C0}{C0}{05}{0C}{09}{01}{A1}{01}{85}{FF}{05}{06}{95}{01}{75}{02

}{19}{24}{29}{26}{81}{02}{75}{06}{81}{01}{C0}{4F}{4B}{0A}

// Initiate a connect to a HID device

>OPEN {BD ADDRESS} HID

>PENDING

>OPEN_OK 17 HID

// Keyboard

>RECV 17 9 {01}{00}{00}{04}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{00}{00}{00}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{02}{00}{00}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{02}{00}{04}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{02}{00}{00}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{00}{00}{00}{00}{00}{00}{00}{00}{0A}

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 67 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

// Mouse

>RECV 17 5 {08}{00}{02}{FF}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

HID device.

// Enable HID device profile and use default keyboard descriptor

>SET PROFILES=X X X X X X X X 1 0 X X

>SET COD=000540

>OK

> WRITE

>OK

> RESET

// Initiate a connect to a HID host

>OPEN {BD ADDRESS} HID

>PENDING

>OPEN_OK 17 HID

// Press ‘a’

>SEND_RAW 17 8

>OK

>{ 00}{00}{04}{00}{00}{00}{00}{00}

// Release ‘a’

>SEND_RAW 17 8

>OK

>{ 00}{00}{00}{00}{00}{00}{00}{00}

// Enable HID device profile

>SET PROFILES=X X X X X X X X 1 0 X X

>SET COD=000580

>OK

> WRITE

>OK

> RESET

// Update HID descriptor to be a mouse

// descriptor:

05010902A1010901A10005091901290815002501950875018102950081030501093009311601F826F

F07750C9502810609381581257F750895018106050C0A380295018106C0C0

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 68 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

>HID_DESC 71

>{05}{01}{09}{02}{A1}{01}{09}{01}{A1}{00}{05}{09}{19}{01}{29}{08}{15}{00}{25}{01}

{95}{08}{75}{01}{81}{02}{95}{00}{81}{03}{05}{01}{09}{30}{09}{31}{16}{01}{F8}{26}{

FF}{07}{75}{0C}{95}{02}{81}{06}{09}{38}{15}{81}{25}{7F}{75}{08}{95}{01}{81}{06}{0

5}{0C}{0A}{38}{02}{95}{01}{81}{06}{C0}{C0}

// Initiate a connect to a HID host

>OPEN {BD ADDRESS} HID

>PENDING

>OPEN_OK 17 HID

// Move the mouse vertically

>SEND_RAW 17 6

>OK

>{ 00}{00}{30}{00}{00}{00}{00}{00}

// Press left button

>SEND_RAW 17 6

>OK

>{ 01}{00}{00}{00}{00}{00}{00}{00}

// Release left button

>SEND_RAW 17 6

>OK

>{ 00}{00}{00}{00}{00}{00}{00}{00}

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 69 of 81

Melody 6.0.33

Melody 6.0.33

8. Multi-connection and audio routing

To be able to connect to multiple devices to Melody you have to set the maximum number of connection per profile.

This can be done by setting up the PROFILES parameter as in the following example:

// Enable 3 A2DP Sink and 3 AVRCP connections

> SET PROFILES=X X 3 0 3 X X X X X X X

>OK

> WRITE

>OK

> RESET

In the following, three devices are connected with the A2DP and AVRCP profiles.

The MUSIC command is used to start streaming music and the ROUTE command allows you to select which stream to listen to:

> STATE CONNECTABLE DISCOVERABLE OFF

>LINK 10 CONNECTED A2DP {BT ADDRESS} SBC SRC 44100

>LINK 11 CONNECTED AVRCP {BTADDRESS} STOPPED

>LINK 20 CONNECTED A2DP {BTADDRESS} SBC SRC 44100

>LINK 21 CONNECTED AVRCP {BTADDRESS} STOPPED

>LINK 30 CONNECTED A2DP {BT ADDRESS} SBC SRC 44100

>LINK 31 CONNECTED AVRCP {BT ADDRESS} STOPPED

> MUSIC 11 PLAY

>OK

>A2DP_STREAM_START 10

>AVRCP_PLAY 11

> MUSIC 21 PLAY

>OK

>A2DP_STREAM_START 20

>AVRCP_PLAY 21

> MUSIC 31 PLAY

>OK

>A2DP_STREAM_START 30

>AVRCP_PLAY 31

// Force audio routing to select device 3

> ROUTE 30

>OK

// Revert to automatic routing (if more than one device is streaming, select to the one that starts playing first, device 1 in this case)

> ROUTE 0

>OK

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 70 of 81

Melody 6.0.33

Melody 6.0.33

9. True Wireless Stereo (TWS)

Here is an example that shows how to stream music from a phone to two Melody devices connected together with TWS.

Melody board 1 Melody board 2

//initial state

> STATUS

>STATE CONNECTABLE DISCOVERABLE OFF

>OK

//search and connect to the TWS device

(melody board 2)

> INQUIRY 10 TWS

>PENDING

>INQUIRY {BT ADDRESS}" melody board 2"

240418 -75db

...

>OK

> OPEN {BT ADDRESS}TWS

>PENDING

>PAIR_PENDING

>PAIR_OK {BT ADDRESS}

>OPEN_OK 1A TWS

>OPEN_OK 11 AVRCP

//device discoverable, phone pairs and connects

> DISCOVERABLE ON

>OK

>PAIR_PENDING

>PAIR_OK {BT ADDRESS 2}

>OPEN_OK 23 HFP

>OPEN_OK 20 A2DP

>OPEN_OK 21 AVRCP

//Phone start streaming music

>AVRCP_PLAY 11

>A2DP_STREAM_START 10

>AVRCP_PLAY 21

//initial state

> STATUS

>STATE CONNECTABLE DISCOVERABLE OFF

>OK

//TWS connection

>PAIR_PENDING

>PAIR_OK {BT ADDRESS}

>OPEN_OK 1A TWS

>OPEN_OK 11 AVRCP

//Phone start streaming music

>AVRCP_PLAY 11

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 71 of 81

Melody 6.0.33

Melody 6.0.33

10. BLE (BC Smart Service)

Melody (Central mode) Melody(Peripheral mode)

// configure device in Central mode

> SET BLE_CONFIG=1

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.8

>Build: 1442512334

>Ready

// scan for peripheral devices

> SCAN 5

>SCAN {BT ADDRESS}1 <BC00187> 12 -84db

......

>OK

// central connects to peripheral

> OPEN {BT ADDRESS} BLE 1

17

>PENDING

>OPEN_OK 14 BLE

// write message

> SEND 14 Hello

18

>OK

// enable notification (BC_SMART Data characteristic)

> BC_SMART_NOTIF 14 ON OFF

>OK

// receive notification

>RECV 14 Hi!!

// send command

>

>OK

BC_SMART_COMMAND 14 STATUS

// configure device in Peripheral mode

> SET BLE_CONFIG=0

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.8

>Build: 1442512334

>Ready

// start advertising

> ADVERTISING ON

>OK

// accept connection

>OPEN_OK 14 BLE

// receive message

>RECV 14 Hello

// send notification

> SEND 14 Hi!!

>OK

// handle command

>STATE CONNECTABLE

CONNECTED

>LINK 14 CONNECTED BLE

>OK

17

By default Melody uses random address as we can see in the scan result (type = 1)

18

To send data over BLE, it is possible to enter in Data mode.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

DISCOVERABLE

Page 72 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

11. BLE central (Generic commands)

In this example, Melody is connected to another board with Melody configured in Peripheral mode (link 14).

Melody (Central mode)

// Get list of services

> BLE_GET_SERV 14

>OK

>BLE 14 U16 1801 [0001 - 0004]

>BLE 14 U16 1800 [0005 - 0009]

>BLE 14 U16 180A [000A - 001C]

>BLE 14 U16 1804 [001D - 001F]

>BLE 14 U16 1802 [0020 - 0022]

>BLE 14 U16 1803 [0023 - 0025]

>BLE 14 U128 BC2F4CC6-AAEF-4351-9034-D66268E328F0 [0026 - 002C]

>BLE 14 U128 67D13B00-89B8-11E3-9DE5-0002A5D5C51B [002D - FFFF]

>OK

// Get list of characteristics (Device Information service)

> BLE_GET_CHAR 14 000A 001C

>BLE 14 U16 2A29 [000C]

>BLE 14 U16 2A24 [000E]

>...

OK

// Get list of characteristics (BC Smart service)

> BLE_GET_CHAR 14 0026 002C

>BLE 14 U128 06D1E5E7-79AD-4A71-8FAA-373789F7D93C [0028]

//BC Smart Data

>BLE 14 U128 818AE306-9C5B-448D-B51A-7ADD6A5D314D [002B]

//BC Smart Command

>OK

// Read characteristic - Manufacturer Name (Device Information service)

> BLE_READ 14 000C

>BLE 14 [000C] 12 42 6C 75 65 43 72 65 61 74 69 6F 6E

//BlueCreation

>OK

// Listen notifications - BC Smart Data (BC Smart service)

19

> BLE_NOTIF 14 0028 ON

>OK

// Write characteristic - BC Smart Data (BC Smart service)

19

> BLE_WRITE 14 0028 5 48 45 4C 4C 4F

//HELLO

>OK

19

Note that with BC Smart Service, it is simpler to use the SEND or the BC_SMART commands

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 73 of 81 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.33

Melody 6.0.33

12. Beacons

This example shows you how to set your beacons parameters. Make sure that BLE is enabled in PROFILES.

To advertise, you can use the ADVERTISING command or enable the auto-advertising feature in

BLE_CONFIG.

> SET BLE_CONFIG=2

>OK

// iBeacon

UUID: 0x00112233-4455-6677-8899-AABBCCDDEEFF

Major: 0x04D2 (1234)

Minor: 0x162E (5678)

Tx Power: -12dBm (0xEE)

> SET BEACON_DATA=0 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 04 D2 16 2E EE

>OK

// Eddystone UID

Namespace: 0x00112233445566778899

Instance: 0xAABBCCDDEEFF

Tx Power: 0xEE

(the last 4 bytes are not used)

> SET BEACON_DATA=1 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF EE 00 00 00 00

>OK

// Eddystone URL

Tx Power: 0xEE

Prefix: 0x02 (http://)

Encoded URL: 0x676F6F2E676C2F495A304F5141 (goo.gl/IZ0OQA)

20

(the last 6 bytes are not used)

> SET BEACON_DATA=2 EE 02 67 6F 6F 2E 67 6C 2F 49 5A 30 4F 51 41 00 00 00 00 00 00

>OK

> WRITE

>OK

> RESET

20

BlueCreation URL encoded with Google URL shortener at https://goo.gl

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 74 of 81

Melody 6.0.33

Melody 6.0.33

13. Tones

The TONE command is used to play back tones on the Melody audio output. Tones are mixed with any ongoing audio playback. See appendix A for more details about the tone parameters.

Here are some examples that demonstrate the TONE command capabilities:

A sample tone:

> TONE TE 400 V 64 TI 0 N C5 L 8 N R0 L 32 N E5 L 8 N R0 L 32 N G5 L 8 N R0 L 32 N

B5 L 4 N R0 L 1 N C6 L 2 TN C6 L 8

>OK

Variable volume single note:

> TONE V 64 N C6 L 4 V 128 N C6 L 4 V 255 N C6 L 4 V 128 N C6 L 4 V 64 N C6 L 4

>OK

Musical scale starting from C4 and omitting any flat and sharp tones:

> TONE V 128 TI 0 N C4 L 8 N D4 L 8 N E4 L 8 N F4 L 8 N G4 L 8 N A4 L 8 N B4 L 8 N

C5 L 8

>OK

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 75 of 81

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement