Set music switch
Function table
__IDO_FUNCTABLE__.funcTable4Model.ancs
Setting up music control requires Bluetooth pairing first
Music Switch Model Description
- IDOSetPairingInfoBuletoothModel
Parameter | Description | Remark |
---|---|---|
pairingTimeStr | Pairing timestamp | str |
isPairing | Is it paired | bool |
- IDOSetMusicOpenInfoBuletoothModel
Parameter | Description/strong> | Remark |
---|---|---|
isOpen | Switch | bool |
Command code
- Bluetooth pairing
Objc:
[IDOFoundationCommand setBluetoothPairingCommandWithCallback:^(BOOL isNeedDisconnect, int stateCode) {
//Whether the pairing process needs to be disconnected, the status of the pairing process
} pairingComplete:^(int errorCode) {
if (errorCode == 0) {
//Set successfully
}else if (errorCode == 6) {
//Device not supported
}else {
//Setup failed
}
}];
Swift:
IDOFoundationCommand.setBluetoothPairingCommandWithCallback({ (isNeedDisconnect, stateCode) in
//Whether the pairing process needs to be disconnected, the status of the pairing process
}) { (errorCode) in
if errorCode == 0 {
//Set successfully
}else if errorCode == 6 {
//Device not supported
}else {
//Setup failed
}
};
- Music switch
Objc:
IDOSetMusicOpenInfoBuletoothModel * model = [IDOSetMusicOpenInfoBuletoothModel currentModel];
[IDOFoundationCommand setOpenMusicCommand:model
callback:^(int errorCode) {
if (errorCode == 0) {
//Set successfully
}else if (errorCode == 6) {
//Device not supported
}else {
//Setup failed
}
}];
Swift:
let model = IDOSetMusicOpenInfoBuletoothModel.current();
IDOFoundationCommand.setOpenMusic(model) { (errorCode) in
if errorCode == 0 {
//Set successfully
}else if errorCode == 6{
//Device does not support this method
}else {
//Wrong setting
}
};