Java Code Examples for no.nordicsemi.android.log.Logger#i()

The following examples show how to use no.nordicsemi.android.log.Logger#i() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BleProfileService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent == null || !intent.hasExtra(EXTRA_DEVICE_ADDRESS))
        throw new UnsupportedOperationException("No device address at EXTRA_DEVICE_ADDRESS key");

    final Uri logUri = intent.getParcelableExtra(EXTRA_LOG_URI);
    logSession = Logger.openSession(getApplicationContext(), logUri);
    deviceName = intent.getStringExtra(EXTRA_DEVICE_NAME);

    Logger.i(logSession, "Service started");

    final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
    final String deviceAddress = intent.getStringExtra(EXTRA_DEVICE_ADDRESS);
    bluetoothDevice = adapter.getRemoteDevice(deviceAddress);

    bleManager.setLogger(logSession);
    onServiceStarted();
    bleManager.connect(bluetoothDevice)
            .useAutoConnect(shouldAutoConnect())
            .retry(3, 100)
            .enqueue();
    return START_REDELIVER_INTENT;
}
 
Example 2
Source File: UARTService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
    final int source = intent.getIntExtra(EXTRA_SOURCE, SOURCE_NOTIFICATION);
    switch (source) {
        case SOURCE_NOTIFICATION:
            Logger.i(getLogSession(), "[Notification] Disconnect action pressed");
            break;
        case SOURCE_WEARABLE:
            Logger.i(getLogSession(), "[WEAR] '" + Constants.ACTION_DISCONNECT + "' message received");
            break;
    }
    if (isConnected())
        getBinder().disconnect();
    else
        stopSelf();
}
 
Example 3
Source File: RSCService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
    Logger.i(getLogSession(), "[Notification] Disconnect action pressed");
    if (isConnected())
        getBinder().disconnect();
    else
        stopSelf();
}
 
Example 4
Source File: BleProfileService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    // Unregister broadcast receivers
    unregisterReceiver(bluetoothStateBroadcastReceiver);

    // shutdown the manager
    bleManager.close();
    Logger.i(logSession, "Service destroyed");
    bleManager = null;
    bluetoothDevice = null;
    deviceName = null;
    logSession = null;
    handler = null;
}
 
Example 5
Source File: HTService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
	Logger.i(getLogSession(), "[Notification] Disconnect action pressed");
	if (isConnected())
		getBinder().disconnect();
	else
		stopSelf();
}
 
Example 6
Source File: UARTService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
    final boolean hasMessage = intent.hasExtra(Intent.EXTRA_TEXT);
    if (hasMessage) {
        String message = intent.getStringExtra(Intent.EXTRA_TEXT);
        if (message == null) {
            final int intValue = intent.getIntExtra(Intent.EXTRA_TEXT, Integer.MIN_VALUE); // how big is the chance of such data?
            if (intValue != Integer.MIN_VALUE)
                message = String.valueOf(intValue);
        }

        if (message != null) {
            final int source = intent.getIntExtra(EXTRA_SOURCE, SOURCE_3RD_PARTY);
            switch (source) {
                case SOURCE_WEARABLE:
                    Logger.i(getLogSession(), "[WEAR] '" + Constants.UART.COMMAND + "' message received with data: \"" + message + "\"");
                    break;
                case SOURCE_3RD_PARTY:
                default:
                    Logger.i(getLogSession(), "[Broadcast] " + ACTION_SEND + " broadcast received with data: \"" + message + "\"");
                    break;
            }
            manager.send(message);
            return;
        }
    }
    // No data od incompatible type of EXTRA_TEXT
    if (!hasMessage)
        Logger.i(getLogSession(), "[Broadcast] " + ACTION_SEND + " broadcast received no data.");
    else
        Logger.i(getLogSession(), "[Broadcast] " + ACTION_SEND + " broadcast received incompatible data type. Only String and int are supported.");
}
 
Example 7
Source File: TemplateService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
    Logger.i(getLogSession(), "[Notification] Disconnect action pressed");
    if (isConnected())
        getBinder().disconnect();
    else
        stopSelf();
}
 
Example 8
Source File: CGMService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
    Logger.i(getLogSession(), "[Notification] Disconnect action pressed");
    if (isConnected())
        getBinder().disconnect();
    else
        stopSelf();
}
 
Example 9
Source File: CSCService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
    Logger.i(getLogSession(), "[Notification] Disconnect action pressed");
    if (isConnected())
        getBinder().disconnect();
    else
        stopSelf();
}