Home
Documentation
Resources
Certifications
Community

Resources

Check for updates on our solutions and system performance, or request technical support.

Community

Get the latest news, ask others for help and share your knowledge.

Manage status - Bluetooth - Mercado Pago Developers

Intelligent search powered by OpenAI 

Manage status

Check how to activate, deactivate and validate the current status of the bluetooth using the BluetoothIgnitor class.

Activate bluetooth

To activate the bluetooth on the Smart POS machine, use the turnOn feature of the BluetoothIgnitor class on our SDK. You can access that feature through the MPManager object, as in the example below.

          
val bluetoothIgnitor = MPManager.bluetooth.ignitor

bluetoothIgnitor.turnOn { response ->
   response
       .doIfSuccess { result ->
           if (result) {
               // Bluetooth was successfully activated
               // Perform additional actions if necessary
           } else {
               // It wasn’t possible to activate the bluetooth
           }
       }.doIfError {
           // Manage the error case if necessary
       }
}

        
          
final BluetoothIgnitor bluetoothIgnitor = MPManager.INSTANCE.getBluetooth().getIgnitor();

final Function1<MPResponse<Boolean>, Unit> callback = (final MPResponse<Boolean> response) -> {
 if (response.getStatus() == ResponseStatus.SUCCESS) {
   if (response.getData()) {
     // Bluetooth was successfully activated
     // Perform additional actions if necessary
   } else {
     // It wasn’t possible to activate the bluetooth
   }
 } else {

   // Manage the error case if necessary
 }
 return Unit.INSTANCE;
};

bluetoothIgnitor.turnOn(callback);

        
FieldDescription
callback ((MPResponse<Boolean>) -> Unit)Request response feature that provides the result of the activation operation. The [MPResponse] includes the status, the error (if any) and the details in case of an error. The response contains a boolean value where true indicates that the bluetooth was activated and false the inability to do so.

Deactivate bluetooth

To deactivate the bluetooth on the Point Smart, use the feature turnOff from the BluetoothIgnitor class. The access is also done through MPManager, as shown below.

          
val bluetoothIgnitor = MPManager.bluetooth.ignitor

bluetoothIgnitor.turnOff { response ->
   response
       .doIfSuccess { result ->
           if (!result) {
               // Bluetooth was successfully deactivated
               // Perform additional actions if necessary
           } else {
               // It wasn’t possible to deactivate the bluetooth
           }
       }
       .doIfError { error ->
           // Manage the error case
       }
}

        
          
final BluetoothIgnitor bluetoothIgnitor = MPManager.INSTANCE.getBluetooth().getIgnitor();

final Function1<MPResponse<Boolean>, Unit> callback = (final MPResponse<Boolean> response) -> {
 if (response.getStatus() == ResponseStatus.SUCCESS) {
   if (!response.getData()) {
     // Bluetooth was successfully deactivated
     // Perform additional actions if necessary
   } else {
     // It wasn’t possible to deactivate the bluetooth
   }
 } else {

   // Manage the error case if necessary
 }
 return Unit.INSTANCE;
};

bluetoothIgnitor.turnOff(callback);

        
FieldDescription
callback ((MPResponse<Boolean>) -> Unit)Request response feature that provides the result of the deactivation operation. The [MPResponse] includes the status, the error (if any), and the details in case of success. The response contains a boolean value where false indicates that the bluetooth was deactivated and true the inability to do so.

Validate the current status of the bluetooth

The feature getCurrentState of the BluetoothIgnitor class is used to validate the activation status of the bluetooth on the Point Smart. The access is through the BluetoothIgnitor instance from the MPManager, as shown in the example below.

          
val bluetoothIgnitor = MPManager.bluetooth.ignitor

bluetoothIgnitor.getCurrentState { result ->
   result
       .doIfSuccess { state ->
           if (state) {
               // Bluetooth is activated
               // Perform additional actions if necessary
           } else {
               // Bluetooth is deactivated
               // Perform additional actions if necessary
           }
       }
       .doIfError { error ->
           // Manage the error case if necessary
       }
}

        
          
final BluetoothIgnitor bluetoothIgnitor = MPManager.INSTANCE.getBluetooth().getIgnitor();

final Function1<MPResponse<Boolean>, Unit> callback = (final MPResponse<Boolean> response) -> {
 if (response.getStatus() == ResponseStatus.SUCCESS) {
   if (!response.getData()) {
     // Bluetooth is activated
     //Perform additional actions if necessary
   } else {
     // Bluetooth is deactivated
     // Perform additional actions if necessary
   }
 } else {
   // Manage the error case if necessary
 }
 return Unit.INSTANCE;
};

bluetoothIgnitor.getCurrentState(callback);

        
FieldDescription
callback ((MPResponse<Boolean>) -> Unit)Request response feature that provides the result the validation of the current status of the bluetooth. The [MPResponse] includes the status, the error (if any) and the details in case of success. The response contains a boolean value where true indicates that the bluetooth is activated and false indicates its deactivation.