Development Examples

[中文版]

Profile Initialization

Module Profile initialization, response event examples are as follows:

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Profile initialization

bt -> host: +PWRSTAT=1
bt -> host: +VER=FSC-BT1058,V1.0.7,20250412
bt -> host: +PROFILE=24747
bt -> host: +SPPSTAT=1
bt -> host: +GATTSTAT=1
bt -> host: +A2DPSTAT=1
bt -> host: +AVRCPSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +PBSTAT=1
bt -> host: +DEVSTAT=1
bt -> host: +DEVSTAT=7

@enduml

Parameter Modification

Modify Bluetooth Name

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Change Bluetooth name
host -> bt: AT+NAME
bt -> host: +NAME=FSC-BT1058-1E49
host -> bt: AT+NAME=CARKIT,0
bt -> host: OK
host -> bt: AT+NAME
bt -> host: +NAME=CARKIT

@enduml

Before the MCU modifies any parameters, it is recommended to first query, then modify, and finally verify. For the MCU to modify the device name to CARKIT, the reference code example is as follows:

void change_name(void)
{

    uart_send("AT+NAME\r\n");
    if(uart_read("+NAME",name_buf))
    {
        if(memcmp(name_buf,"CARKIT",6))
        {
            uart_send("AT+NAME=CARKIT,0\r\n");  //defalut disable MAC address suffix
            uart_send("AT+NAME\r\n"); // read bt name
            if(uart_read("+NAME",name_buf))
            {
                if(memcmp(name_buf,"CARKIT",6))
                {
                    //change name fail
                }
                else
                {
                    //change name success
                }
            }
        }
    }
}

Classic Auido Sink Mode Application

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Profile initialization

bt -> host: +PROFILE=1195
bt -> host: ...
bt -> host: +DEVSTAT=7

rnote over host, bt: Mobile phone scan and connect to BT1058
bt -> host: +A2DPSTAT=2
bt -> host: +A2DPSTAT=3 (A2DP connected)
bt -> host: +A2DPDEV=8C861E94A09E,Navy
bt -> host: +AVRCPSTAT=3 (AVRCP connected)
bt -> host: +HFPSTAT=3 (HFP connected)
bt -> host: +HFPDEV=8C861E94A09E,Navy
bt -> host: +HFPSIG=3
bt -> host: +HFPBATT=4
bt -> host: +HFPROAM=0
bt -> host: +HFPNUM=8618620277271
bt -> host: +HFPMANU=AppleInc.

host -> bt: AT+HFPDIAL=10086 (Take call 10086)
bt -> host: OK
bt -> host: +HFPSTAT=4,10086
bt -> host: +HFPAUDIO=1 (HFP audio link has been established)
bt -> host: +HFPSTAT=6,10086 (call active)
host -> bt: AT+HFPCHUP(Hang up)
bt -> host: +HFPSTAT=3
bt -> host: +HFPAUDIO=0 (HFP audio link has been disconnected)

host -> bt: AT+PLAY(play music)
bt -> host: +A2DPSTAT=5
bt -> host: +PLAYSTAT=1
bt -> host: +TRACKINFO=song,artist,album
bt -> host: +TRACKSTAT=1,1000,240000
bt -> host: +TRACKSTAT=1,2000,240000
host -> bt: AT+PAUSE(pause music)
bt -> host: +PLAYSTAT=2
bt -> host: +A2DPSTAT=3

@enduml

Phonebook Download

Note

For some firmware versions of SOC audio modules, automatic connection to PBAP (Phone Book Access Profile) is not supported when downloading contacts. You need to first send the AT command AT+PBCONN to establish a PBAP connection before proceeding with the download.

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: HFP connected

bt -> host: ...
bt -> host: +HFPSTAT=3

rnote over host, bt: Download all phone books
host -> bt: AT+PBDOWN=1
bt -> host: +PBSTAT=2
bt -> host: +PBSTAT=3 (PBAP is connected)
bt -> host: +PBSTAT=4 (PBAP is being downloaded)
bt -> host: +PBDATA=1,local number,+8618620277272
bt -> host: +PBDATA=1,Tom,0571-85592192
bt -> host: ...
bt -> host: +PBDATA=1,Jerry,18909731215
bt -> host: +PBDATA=E (download completes)
bt -> host: +PBSTAT=3


rnote over host, bt: Download 50 call records
host -> bt: AT+PBWODN=5,50
bt -> host: +PBDATA=3,China Mobile,+10086,20200213T114247
bt -> host: ...
bt -> host: +PBDATA=2,Andy,18885592192,20200212T104202
bt -> host: +PBDATA=E
bt -> host: +PBSTAT=3

@enduml

LE Audio Application

Note

The application examples in this section are based on the general firmware versions of the FSC-BT1058 module (including V1.0.8 and earlier). Functional or operational differences may exist in new firmware versions, and updates will be continuously provided with subsequent firmware iterations.

LE Audio Broadcast Application

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Profile initialization

bt -> host: +PROFILE=2385
bt -> host: ...
bt -> host: +DEVSTAT=7

rnote over host, bt: Module initiates broadcast source scanning
host -> bt: AT+BISSCAN=5
bt -> host: +BIS=1,-61,15,98,DC0D30000062,FSC-BP410-0062
bt -> host: +BIS=2,-48,15,43356,00025B00FF0E,FSC-BP415-ff0e
bt -> host: +SCAN=E
rnote over host, bt: The module connect to the broadcast source.
host -> bt: AT+BISADD=15,43356
bt -> host: +BISADD=15,43356
bt -> host: OK
bt -> host: +BISSTAT=4
bt -> host: +BISSTAT=5


@enduml

Device mode switching

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt: Switch to Master mode
host -> bt: AT+MODCFG=1
bt -> host: +SPPSTAT=1
bt -> host: +A2DPSTAT=1
bt -> host: +AVRCPSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +LEASTAT=1
bt -> host: +MASTER

rnote over host, bt: Switch to Slave mode
host -> bt: AT+MODCFG=0
bt -> host: +SPPSTAT=1
bt -> host: +A2DPSTAT=1
bt -> host: +AVRCPSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +LEASTAT=1
bt -> host: +SLAVE


@enduml

Broadcast interaction as a sink in LE Audio

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt:LEA broadcast sink init

host -> bt: ...
bt -> host: +BISSTAT=1

rnote over host, bt: Scan for nearby broadcast sources
host -> bt: AT+BISSCAN=10
bt -> host: broadcast_name:Feasycomff04, broadcast_id:7019, advertising_sid:14, rssi:-75

rnote over host, bt: Add and synchronize nearby broadcast sources
host -> bt: AT+BISADD=14,7019
bt -> host: +BISADD=14,7019
bt -> host: +BISSTAT=5

@enduml

Unicast interaction as a sink in LE Audio

@startuml
hide footbox
skinparam sequenceMessageAlign center

box  #LightBlue
participant Host as host
participant Blueware as bt
end box

rnote over host, bt:LEA unicast sink init

bt -> host: ...
bt -> host: +CISSTAT=1
bt -> host: +HFPSTAT=1
bt -> host: +A2DPSTAT=1
bt -> host: +GATTSTAT=3
bt -> host: +CISSTAT=3
bt -> host: +CISSTAT=4



@enduml