[MPAccessoryParameters externalAccessoryParametersWithFamily:MPAccessoryFamilyMiuraMPI protocol:@"com.miura.shuttle" optionals:^(id optionals) {[optionals setKeepAlive:YES];}];
MPAccessoryModule *accessoryModule = transactionProvider.accessoryModule; MPAccessory *accessory = [[accessoryModule connectedAccesories] firstObject]; [accessoryModule disconnectFromAccessory:accessory statusChanged:^(MPAccessoryProcess *accesoryProcess, MPAccessory *accessory, MPAccessoryProcessDetails *details) { // status updates on the disconnect process } completed:^(MPAccessoryProcess *accesoryProcess, MPAccessory *accessory, MPAccessoryProcessDetails *details) { if (details.state == MPAccessoryProcessDetailsStateFailed) { NSLog(@"Disconnect failed with error: %@", details.error); } else { NSLog(@"Disconnect success"); } }];
AccessoryParameters params = new AccessoryParameters.Builder(AccessoryFamily.MIURA_MPI). bluetooth().keepAlive(true).build();
AccessoryModule accessoryModule = transactionProvider.getAccessoryModule(); Accessory accessory = accessoryModule.getConnectedAccessories().get(0); accessoryModule.disconnectFromAccessory(accessory, new AccessoryDisconnectListener2() { @Override public void onStatusChanged(AccessoryProcess process, Accessory model, AccessoryProcessDetails processDetails) { // status updates on the ongoing process } @Override public void onCompleted(AccessoryProcess process, Accessory model, AccessoryProcessDetails processDetails) { // disconnection finished, check the process details for the outcome if (processDetais.getState() == AccessoryProcessDetails.FAILED) { Log.d(TAG, "disconnect failed: " + processDetais.getError()); } else { Log.d(TAG, "disconnect success"); } } });