Kullanıcı Kılavuzu

Scan Devices

Scan Devices

The Scan Devices action is used in a mobile application developed with Kuika to scan Bluetooth devices near the device and obtain a list of these devices. This allows the user to see nearby devices that are open to pairing and easily connect to the desired device.

Technical Features

  • Nearby Device Detection: Lists nearby devices that are open to pairing when Bluetooth is enabled.
  • Service-Based Filtering: Filtering can be performed for devices with specific Service ID information.
  • Device Selection and Connection Flow: Users can select a device from the list of devices returned by the scan and connect directly.
  • User Notification: An information message can be displayed to the user during the connection.
  • Mobile Compatibility: The action only works on Android and iOS-based Kuika mobile projects.

Scan Devices Action Application Steps

1. Add Bluetooth Data Source

  • Log in to the Kuika platform.
  • Open your mobile project from the Apps screen.
  • Go to the Datasources module.
  • Open the new data source screen by clicking the + icon on the left. Then select Bluetooth as the Datasource Type.
  • Fill in the required fields:
  • Device Name (required)
  • Device ID, Device Address (optional)
  • Click the CREATE button.

2. Defining the Bluetooth Method

  • Open the data source you created → click the ADD NEW METHOD button.
  • Enter the required fields:
    • Name
    • Characteristic ID
    • Service ID
    • Characteristic Type: Read, Write, Notify, Indicate
  • Save with SAVE.

3. Adding the Scan Devices Action

  • Click on the method you created.
  • In the right panel, select +ADD ACTION → Custom → userguide123 → ScanDevices_bluetooth.

Parameter Definitions

Required Parameters:

  • executePageInitActionAfterClose (Boolean):
    • When set to true, page init actions are automatically retriggered after the device scanning window is closed.

Optional Parameters:

  • serviceIds (Array of UUIDs):
    • Scans only Bluetooth devices with specific Service IDs. Example: [“0000180d-0000-1000-8000-00805f9b34fb”] (Heart Rate Service)
  • connectingMessage (String):
    • Information message to be displayed during connection. Example: “Connecting to device, please wait...”

Usage Scenario: Device Scan Screen

When a user arrives at the “Add Device” screen in the application, the system scans nearby Bluetooth devices and presents a list to the user. The user can select a device from this list to initiate the connection process.

1. Go to the UI Design module.

  • Add a Button element to the “Search for Devices” screen.
  • In the Properties panel, set the button's name to “Start Scan.”

2. For the button action, from the + ADD ACTION menu:

  • OnClick → Custom → Kuika → ScanDevices_bluetooth add the action.

3. Set the action parameters:

  • executePageInitActionAfterClose = true
  • connectingMessage = “Searching for Bluetooth devices...”
  • serviceIds = [“12345678-1234-1234-1234-1234567890ab”] (Relevant service UUID)

4. (Optional) To connect after a device is selected:

  • When the user selects a device from the list that appears after the ScanDevices action:
  • Custom → Kuika → Connect_bluetooth action can be triggered.

With this scenario, the user can see the devices in a list when the scan is started and easily connect to the desired device. To enhance the user experience, the name of the selected device can be displayed or a connection success notification can be added.

Scan Devices Action Advanced Customizations

  • Service-Based Device List: Only specific types of devices can be shown to the user using Service IDs that represent different device types.
  • Automatic Selection: Previously connected devices are detected using SavedDeviceAvailable, and if they are nearby, connection can be attempted directly instead of scanning devices.
  • Post-Process Page Refresh: The page data can be automatically refreshed after scanning with the executePageInitActionAfterClose = true parameter.
  • Scan Timer: If the user cannot find a device within a specified time, automatic scanning can be restarted.

Technical Risks and Precautions

  • Bluetooth is turned off: Scanning is not performed; a preliminary check should be performed with the Bluetooth Is Open action.
  • Permission issue: Scanning cannot be performed if permission has not been obtained from the user with Bluetooth Permission Is Given.
  • Device density: Performance may be affected if a large number of devices are listed at the same time. A limit can be imposed on the list.
  • User Interaction: If the user exits the scan window without selecting a device, the next steps should be checked.
  • UUID Mismatch: If the serviceIds UUIDs are not defined in the correct format, the scan will fail.

Scan Devices is a powerful action that enables users to quickly detect nearby Bluetooth devices and connect to the appropriate device. It can be used to significantly simplify the user experience in medical devices, smart home applications, and IoT projects. With advanced customization and integration options, it provides full compatibility with your system.

Other Related Content

No items found.

Glossary

No items found.

Alt Başlıklar