カスタム Bluetooth スキャナ通知

DataWedge 15.0

通知 (カスタム)

カスタム Bluetooth スキャナ通知は、サポートされている Bluetooth スキャナでの通知の表示方法をより柔軟に制御します。この機能を使用すると、Remote Scanner Management (RSM) を介して、Bluetooth スキャナによるスキャン後の LED パターン、ビープ音、および振動シーケンスをカスタマイズできます。これらをカスタマイズすることにより、アプリケーションの要件に合わせたさまざまな通知方法が可能になります。このカスタム通知 API では、標準の 通知 (Bluetooth スキャナ通知) API よりきめ細かに制御できます。

カスタム通知機能は、次の DataWedge バージョン以降で使用できます。

  • Android 13: DataWedge v14.3.4 以降
  • Android 14: DataWedge v15.0.28 以降

サポートされている Bluetooth スキャナとデバイス識別子:

Bluetooth スキャナ デバイス識別子
DS3678 BLUETOOTH_DS3678
RS5100 BLUETOOTH_RS5100
RS6000 BLUETOOTH_RS6000
RS6100 BLUETOOTH_GENERIC

構成設定

LED、ビープ音、および振動通知の設定項目:

  • LED設定:
    • 色 - RGB 形式で指定します (例: 赤の場合は 0xFF0000)。
    • オン/オフ時間 - 点灯時間と消灯時間をミリ秒単位で指定します。
    • 繰り返し回数 - LED パターンを繰り返す回数を設定します。
  • ビープ音設定:
    • 周波数 - ヘルツ単位で設定します。
    • オン/オフ時間 - 各ビープ音の鳴動時間と休止時間をミリ秒単位で指定します。
    • 繰り返し回数 - ビープ音を繰り返す回数を指定します。
  • 振動設定:
    • オン/オフ時間 - 振動時間と休止時間をミリ秒単位で設定します。
    • 繰り返し回数 - 振動を繰り返す回数を指定します。

関数プロトタイプ

LED、ビープ音、および振動設定のサブバンドルを作成します。例:

  • LED設定:

    Bundle ledSettings = new Bundle(); ledSettings.putInt("COLOR", 0xFF0000); // Red color ledSettings.putInt("ON_TIME", 500); // LED on for 500ms ledSettings.putInt("OFF_TIME", 500); // LED off for 500ms ledSettings.putInt("REPEAT_COUNT", 3); // Number of repetitions notificationSettings.putBundle("LED_SETTINGS", ledSettings);
  • ビープ音設定:

    Bundle beepSetting = new Bundle(); beepSetting.putInt("BEEP_FREQUENCY", 1000); // 1000Hz frequency beepSetting.putInt("ON_TIME", 500); // 500ms on beepSetting.putInt("OFF_TIME", 500); // 500ms off beepSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions Parcelable[] beepSettings = new Parcelable[]{beepSetting}; notificationSettings.putParcelableArray("BEEP_SETTINGS", beepSettings);
  • 振動設定:

    Bundle vibratorSetting = new Bundle(); vibratorSetting.putInt("ON_TIME", 500); // Vibration on for 500ms vibratorSetting.putInt("OFF_TIME", 500); // Vibration off for 500ms vibratorSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions Parcelable[] vibratorSettings = new Parcelable[]{vibratorSetting}; notificationSettings.putParcelableArray("VIBRATOR_SETTINGS", vibratorSettings);

パラメータ

ACTION [string]: "com.symbol.datawedge.api.ACTION" DataWedge API との通信に使用されるインテントアクション。

EXTRA_DATA [string]: "com.symbol.datawedge.api.notification.NOTIFY" 通知設定を渡すためにインテント内で使用されるエクストラ データ キー。

DEVICE IDENTIFIER [string]: サポートされている Bluetooth スキャナのデバイス識別子。Bluetooth スキャナの一意の識別子 ("BLUETOOTH_RS6000"など) を指定します。

NOTIFICATION_SETTINGS [Bundle]: 通知設定を格納するバンドル。LED、ビープ音、バイブレーション通知の設定が含まれ、それぞれの設定は色、周波数、オン/オフ時間、繰り返し回数などのパラメータで定義されます。

結果コード

DataWedge は、アプリにインテント エクストラ (SEND_RESULT および COMMAND_IDENTIFIER) が含まれている場合、次のエラー コードを返し、DataWedge の結果インテント メカニズムを使用してアプリで結果を取得できるようにします。以下のを参照してください。

  • DATAWEDGE_DISABLED - DataWedge が無効です
  • DEVICE_NOT_SUPPORTED - デバイスがサポートされていません
  • PARAMETER_INVALID - RSM 属性配列に値が指定されていません
  • DEVICE_NOT_CONNECTED - スキャナが接続されていません

手順

カスタム通知を設定するには、次の手順に従います。

  1. メインバンドルの初期化 - すべてのカスタム通知設定を格納する Bundle を作成します。

  2. デバイス識別子の指定 - DEVICE_IDENTIFIER キーを使用して、Bluetooth スキャナに一意の識別子を割り当てます。

  3. 通知の詳細の設定 - LED、ビープ音、および振動設定用にサブ バンドルを作成します。「関数プロトタイプ」を参照してください。

  4. 通知の送信:
         a. notificationSettingsdeviceBundle に追加します。
         b. ブロードキャスト インテントを使用して、これらの設定を適用します。

    deviceBundle.putBundle("NOTIFICATION_SETTINGS", notificationSettings);

コード例

次のサンプルコードは、赤の LED、1000Hz のビープ音、および振動パターンを使用して通知を設定する方法を示しています。

import android.content.Intent; import android.os.Bundle; import android.os.Parcelable; // Initialize the main bundle for settings Bundle deviceBundle = new Bundle(); // Assign the device identifier deviceBundle.putString("DEVICE_IDENTIFIER", "BLUETOOTH_RS6000"); // Bundle for notification settings Bundle notificationSettings = new Bundle(); // LED Settings Bundle ledSettings = new Bundle(); ledSettings.putInt("COLOR", 0xFF0000); // Red color ledSettings.putInt("ON_TIME", 500); // LED on for 500ms ledSettings.putInt("OFF_TIME", 500); // LED off for 500ms ledSettings.putInt("REPEAT_COUNT", 3); // Number of repetitions notificationSettings.putBundle("LED_SETTINGS", ledSettings); // Beep Settings Bundle beepSetting = new Bundle(); beepSetting.putInt("BEEP_FREQUENCY", 1000); // 1000Hz frequency beepSetting.putInt("ON_TIME", 500); // 500ms on beepSetting.putInt("OFF_TIME", 500); // 500ms off beepSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions Parcelable[] beepSettings = new Parcelable[]{beepSetting}; notificationSettings.putParcelableArray("BEEP_SETTINGS", beepSettings); // Vibration Settings Bundle vibratorSetting = new Bundle(); vibratorSetting.putInt("ON_TIME", 500); // Vibration on for 500ms vibratorSetting.putInt("OFF_TIME", 500); // Vibration off for 500ms vibratorSetting.putInt("REPEAT_COUNT", 3); // Number of repetitions Parcelable[] vibratorSettings = new Parcelable[]{vibratorSetting}; notificationSettings.putParcelableArray("VIBRATOR_SETTINGS", vibratorSettings); // Add notification settings to device bundle deviceBundle.putBundle("NOTIFICATION_SETTINGS", notificationSettings); // Intent to broadcast the notification configuration Intent i = new Intent(); i.setAction("com.symbol.datawedge.api.ACTION"); // Create and add the notification configuration bundle Bundle bundleNotificationConfig = new Bundle(); bundleNotificationConfig.putString("DEVICE_IDENTIFIER", "BLUETOOTH_RS6000"); bundleNotificationConfig.putBundle("NOTIFICATION_SETTINGS", notificationSettings); // Bundle for notification Bundle bundleNotify = new Bundle(); bundleNotify.putBundle("NOTIFICATION_CONFIG", bundleNotificationConfig); // Add notification bundle to intent i.putExtra("com.symbol.datawedge.api.notification.NOTIFY", bundleNotify); // Broadcast the intent this.sendBroadcast(i);

関連項目:

Zebra Support Central | インテグレータ ガイド、製品マニュアル、ソフトウェア ダウンロードおよびサポート

LaunchPad | Zebra 開発者コミュニティ

インテント | Android 開発者

インテントおよびインテント フィルタ | Android 開発者

Android インテント | チュートリアル