### Permission Guide Configuration (JSON) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_permission_showauthguide.mdx This JSON configuration object provides default settings for the permission guide dialog. It specifies the 'defaultTitle' for the dialog, which is set to 'Permission guide' in this example. ```json { "defaultTitle": "Permission guide" } ``` -------------------------------- ### JavaScript Bluetooth Adapter Initialization and State Management Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx This JavaScript code demonstrates how to initialize and manage the Bluetooth adapter using the `my` API. It includes functions to open, close, and get the current state of the Bluetooth adapter, providing user feedback via alerts. ```javascript Page({ data: { devid: '0D9C82AD-1CC0-414D-9526-119E08D28124', serid: 'FEE7', notifyId: '36F5', writeId: '36F5', charid: '', alldev: [{ deviceId: '' }], }, //Obtain the Bluetooth state openBluetoothAdapter() { my.openBluetoothAdapter({ success: res => { if (!res.isSupportBLE) { my.alert({ content: 'Sorry, your mobile Bluetooth is unavailable temporarily' }); return; } my.alert({ content: 'Succeeded to initialize!' }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, closeBluetoothAdapter() { my.closeBluetoothAdapter({ success: () => { my.alert({ content: 'Bluetooth closed!' }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, getBluetoothAdapterState() { my.getBluetoothAdapterState({ success: res => { if (!res.available) { my.alert({ content: 'Sorry, your mobile Bluetooth is unavailable temporarily' }); return; } my.alert({ content: JSON.stringify(res) }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, //Scan the Bluetooth device startBluetoothDevicesDiscovery() { my.startBluetoothDevicesDiscovery({ allowDuplicatesKey: false, success: () => { my.onBluetoothDeviceFound({ success: res => { // my.alert({content:'Listens to new device'+JSON.stringify(res)}); var deviceArray = res.devices; for (var i = deviceArray.length - 1; i >= 0; i--) { var deviceObj = deviceArray[i]; //Pair the target device with the device name or broadcast data, and then record the device ID for later use. if (deviceObj.name == this.data.name) { my.alert({ content: 'Target device is found' }); my.offBluetoothDeviceFound(); ``` -------------------------------- ### Start Bluetooth Discovery Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Initiates the discovery of Bluetooth devices. It listens for device discovery events and handles success or failure scenarios. ```APIDOC ## Start Bluetooth Discovery ### Description Initiates the discovery of Bluetooth devices. It listens for device discovery events and handles success or failure scenarios. ### Method POST ### Endpoint /bluetooth/discovery/start ### Parameters #### Query Parameters - **deviceId** (string) - Required - The ID of the device to scan for. ### Request Example ```json { "deviceId": "some_device_id" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "Discovery started successfully" } ``` ``` -------------------------------- ### Configure Guide Component (JSON) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_extended-component_guide_guide.mdx This JSON snippet shows how to configure the guide component within a project's configuration file. It specifies the default title and the path to the guide component's implementation. ```json { "defaultTitle": "Guide", "usingComponents":{ "guide": "mini-ali-ui/es/guide/index" } } ``` -------------------------------- ### Manage Guide Component Logic (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_extended-component_guide_guide.mdx This JavaScript code provides the logic for the guide component. It initializes data, including a list of guide steps with image URLs and positions, and defines functions to close the guide. ```javascript Page({ data: { list: [ { url: 'https://example.com/as/g/dnestFEGroup/dnestCompetFE/0.3.54/public/ii_bg1.49350b69.jpg', x: '150rpx', y: '100rpx', width: '200px', height: '300px', }, { url: 'https://example.com/as/g/dnestFEGroup/dnestCompetFE/0.3.54/public/ii_bg1.49350b69.jpg', x: '250rpx', y: '50rpx', width: '200px', height: '100px', }, { url: 'https://example.com/as/g/dnestFEGroup/dnestCompetFE/0.3.54/public/ii_bg1.49350b69.jpg', x: '350rpx', y: '200rpx', width: '100px', height: '300px', }, { url: 'https://example.com/as/g/dnestFEGroup/dnestCompetFE/0.3.54/public/ii_bg1.49350b69.jpg', x: '400rpx', y: '200rpx', width: '200rpx', height: '300rpx', }, ], }, onLoad() { }, closeGuide() { this.setData({ guideShow: false, }); }, }); ``` -------------------------------- ### Implement Guide Component UI (AXML) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_extended-component_guide_guide.mdx This AXML snippet demonstrates the structure of the guide component in the UI. It includes attributes for controlling visibility, jump behavior, content list, button text, and event handling, along with buttons to trigger guidance. ```xml ``` -------------------------------- ### List and List-item Usage Example (HTML) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_extended-component_layout-navigation_list.mdx An example demonstrating how to use the List and List-item components in HTML. It shows how to populate lists with data, including headers, footers, and item-specific content. ```html List Header {{item.title}} {{item.brief}} {{item.extra}} List footer List Header {{item.title}} {{item.brief}} {{item.extra}} List footer ``` -------------------------------- ### Start Bluetooth Device Discovery (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Initiates the discovery of Bluetooth devices. It includes success and failure callbacks to handle the results of the discovery process. This function relies on the 'my' API for Bluetooth operations. ```javascript startBluetoothDevicesDiscovery() { my.startBluetoothDevicesDiscovery({ success: () => { my.onBluetoothDeviceFound(res => { for (var i = 0; i < res.devices.length; i++) { if (res.devices[i].deviceId == deviceObj.deviceId) { this.setData({ deviceId: deviceObj.deviceId, }); break; } } }); }, fail: error => { my.alert({ content: 'Failed to listen to new device' + JSON.stringify(error) }); }, }); } ``` -------------------------------- ### app.json Pages Configuration Example Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_framework_app_global-configuration.mdx An example illustrating how to configure the 'pages' array in app.json. This array specifies the paths to different pages within the Mini Program, with the first entry serving as the home page. ```json { "pages":[ "pages/index/index", "pages/logs/logs" ] } ``` -------------------------------- ### Show Authorization Guide (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/llms-index.md Displays an authorization guide to the user, typically used when a permission is denied. This function returns a promise that resolves on success. ```javascript my.showAuthGuide({ success: function(res) { console.log('showAuthGuide success') }, fail: function(res) { console.log('showAuthGuide fail') }, complete: function(res) { console.log('showAuthGuide complete') } }) ``` -------------------------------- ### Start Bluetooth Device Discovery Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_onbluetoothadapterstatechange.mdx Initiates the discovery of Bluetooth devices. It registers a callback for when devices are found and includes error handling for the discovery process. This function relies on the 'my' API, likely from a specific SDK. ```javascript startBluetoothDevicesDiscovery() { my.startBluetoothDevicesDiscovery({ success: () => { my.onBluetoothDeviceFound(device => { if (device.deviceId === deviceObj.deviceId) { this.setData({ deviceId: deviceObj.deviceId, }); break; } }); }, fail: error => { my.alert({ content: 'Failed to listen to new device' + JSON.stringify(error) }); }, }); }, fail: error => { my.alert({ content: 'Failed to start scanning' + JSON.stringify(error) }); }, }); ``` -------------------------------- ### Permission Guide UI Structure (HTML) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_permission_showauthguide.mdx This HTML snippet defines the basic structure for a page that includes a button to trigger the permission guide. It sets up a view with a title and a button labeled 'Permission guide' which, when tapped, will invoke the associated JavaScript function. ```html Permission guide API my.showAuthGuide ``` -------------------------------- ### Install Mini Program Extended Component Library Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_extended-component_overview.mdx Installs the mini-ali-ui dependency using npm. This command adds the library to your project's dependencies. ```bash $ npm install mini-ali-ui --save ``` -------------------------------- ### Guide Users to Enable Permissions using my.showAuthGuide Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_media_video_choosevideo.mdx This API is used to guide users to enable specific permissions within the application. It is typically called when a feature requires a permission that the user has not yet granted. ```javascript my.showAuthGuide({ // Permission type, e.g., 'album', 'camera' }); ``` -------------------------------- ### POST /v1/users/inquiryUserInfo Request Example Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_v1_users_inquiryuserinfo.mdx Example of a POST request to the /v1/users/inquiryUserInfo endpoint. This request requires an access token and can optionally include extended information. ```javascript fetch('/v1/users/inquiryUserInfo', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ accessToken: 'YOUR_ACCESS_TOKEN', extendInfo: JSON.stringify({ "memo": "memo" }) }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### POST /v1/users/inquiryUserInfo Response Example Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_v1_users_inquiryuserinfo.mdx Example of a successful response from the /v1/users/inquiryUserInfo endpoint. It includes a result object and, upon success, user information. ```json { "result": { "resultCode": "SUCCESS", "resultStatus": "S", "resultMessage": "success" }, "userInfo": { "userId": "12345", "nickName": "TestUser", "avatar": "http://example.com/avatar.png" } } ``` -------------------------------- ### Example UserAgent String for Mini Program Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_platform_transform-html5.mdx This example shows a typical UserAgent string when a web page is running as an HTML mini program. It includes specific fields like 'MiniProgram' that can be used for identification. ```plaintext Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/18D46 ChannelId(35) Ariver/1.0.11 Griver/2.23.0 AppContainer/1.9.1 MiniProgram ``` -------------------------------- ### Show Permission Guide Dialog (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_permission_showauthguide.mdx This JavaScript code demonstrates how to call the my.showAuthGuide API to display a permission guide dialog. It includes success and failure callbacks to handle the API response. The 'authType' parameter is crucial for specifying which permission guide to show. ```javascript Page({ showAuthGuide() { my.showAuthGuide({ authType:'LBS', success:(res)=>{ //When shown is true, it indicates the permission guide pop-up will be shown; when it is false, it indicates the user has allowed the permission. my.alert({content: 'Call success: '+JSON.stringify(res) }); }, fail:(error)=>{ my.alert({content: 'Call failure:'+JSON.stringify(error) }); }, }); }, }); ``` -------------------------------- ### Start Bluetooth Device Discovery (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_ble_onblecharacteristicvaluechange.mdx Initiates the discovery of Bluetooth devices. It registers a callback for when a device is found and includes error handling for the discovery start process. This function is crucial for finding nearby Bluetooth devices. ```javascript startBluetoothDevicesDiscovery() { my.startBluetoothDevicesDiscovery({ success: res => { my.onBluetoothDeviceFound(device => { if (device.deviceId === deviceObj.deviceId) { my.stopBluetoothDevicesDiscovery(); my.connectBLEDevice({ deviceId: deviceObj.deviceId, }); break; } }); }, fail: error => { my.alert({ content: 'Failed to start scanning' + JSON.stringify(error) }); }, }); } ``` -------------------------------- ### Install APMP CLI Globally Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_command-line.mdx Installs the Alipay Plus Mini Program Command-line Interface globally using npm. This command makes the 'apmp' command available system-wide. ```shell npm install apmp -g ``` -------------------------------- ### Configure App Entry Point and Global Data in app.js Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_quick-start_learn-more-about-todo-app-demo.mdx The `app.js` file serves as the entry point for a Mini Program. It allows configuration of the app's lifecycle, declaration of global variables, and app initialization. This example demonstrates calling storage APIs to retrieve and set data, as well as fetching user information. ```javascript // Call the storage API to get the stored data const todos = my.getStorageSync({key:'todos'}).data || [ { text: 'Learning Javascript', completed: true }, { text: 'Learning ES2016', completed: true }, { text: 'Learning Mini Program ', completed: false }, ]; App({ // Declare global data todos, userInfo: null, // Declare global method setTodos(todos) { this.todos = todos; // Call storage API to store data my.setStorageSync({key:'todos', data:todos}); }, getUserInfo() { return new Promise((resolve, reject) => { if (this.userInfo) resolve(this.userInfo); // Call user authorization API to get user info my.getAuthCode({ success: (authcode) => { console.info(authcode); my.getAuthUserInfo({ scopes: ['auth_user'], success: (res) => { this.userInfo = res; resolve(this.userInfo); }, fail: () => { reject({}); }, }); }, fail: () => { reject({}); }, }); }); }, }); ``` -------------------------------- ### Mini Program Directory Structure Example Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_quick-start_understand-the-mini-program-file-structure.mdx Illustrates the typical directory structure for a Mini Program, including directories for static assets, custom components, and individual pages. It also shows the location of global configuration files. ```text assets // Store various static resources, such as images components // Custom component directory of Mini Program --add-button // Here we defined a component called add-button pages // All pages included in the Mini Program are placed under “pages”, one folder per page --add-todo // Mini Program page --Todos // Mini Program page app.js // Here some global service logic is configured for the Mini Program, such as global method and global variables app.acss // Global style configuration, here the styles take effect on every page app.json // Some basic configuration info for the Mini Program pages, such as page path ``` -------------------------------- ### Get All Bluetooth Devices Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Retrieves a list of all discovered Bluetooth devices. ```APIDOC ## Get All Bluetooth Devices ### Description Retrieves a list of all discovered Bluetooth devices. ### Method GET ### Endpoint /bluetooth/devices ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **devices** (array) - A list of discovered Bluetooth devices. - **deviceId** (string) - The ID of the discovered device. - **name** (string) - The name of the discovered device. #### Response Example ```json { "devices": [ { "deviceId": "device456", "name": "Bluetooth Mouse" }, { "deviceId": "device789", "name": "Bluetooth Keyboard" } ] } ``` ``` -------------------------------- ### Using my.alert JSAPI Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_platform_transform-html5.mdx Example demonstrating how to use the `my.alert` JSAPI, including its common and specific properties, and callback functions. ```APIDOC ## Using my.alert JSAPI ### Description This section provides an example of how to call the `my.alert` JSAPI. It illustrates the usage of common callback properties (`success`, `fail`, `complete`) and specific properties like `title`, `content`, and `buttonText`. ### Method JavaScript Function Call ### Endpoint `my.alert` ### Parameters #### Request Body - **title** (string) - Optional - The title of the alert box. - **content** (string) - Required - The main text content to display in the alert. - **buttonText** (string) - Optional - The text to display on the alert button. - **success** (function) - Optional - Callback function executed upon successful API call. - **fail** (function) - Optional - Callback function executed if the API call fails. - **complete** (function) - Optional - Callback function executed after the API call completes, regardless of success or failure. ### Request Example ```javascript my.alert({ title: 'Test Alert!!', content: window.navigator.userAgent, buttonText: 'Alert Button', success: function (res) { my.alert({ content: 'success!' + JSON.stringify(res), }); }, fail: function () { my.alert({ content: 'fail!', }); }, complete: function () { my.alert({ content: 'complete!', }); }, }); ``` ### Response #### Success Response (200) - **res** (object) - An object containing results of the operation (details depend on the specific API). #### Response Example ```json { "message": "Operation successful" } ``` ``` -------------------------------- ### Install JS Bridge Package Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_jsbridge-guide.mdx Installs the 'hylid-bridge' package using npm. This is the first step for integrating JS bridge into your mini program project. It ensures the necessary library is available for use. ```bash npm install hylid-bridge --save ``` -------------------------------- ### Get BLE Device Services Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Retrieves the services offered by a connected BLE device. ```APIDOC ## Get BLE Device Services ### Description Retrieves the services offered by a connected BLE device. ### Method GET ### Endpoint /ble/device/{deviceId}/services ### Parameters #### Path Parameters - **deviceId** (string) - Required - The ID of the BLE device. ### Request Example ```json {} ``` ### Response #### Success Response (200) - **services** (array) - A list of services offered by the device. - **serviceId** (string) - The ID of the service. - **uuid** (string) - The UUID of the service. #### Response Example ```json { "services": [ { "serviceId": "serviceABC", "uuid": "180d" } ] } ``` ``` -------------------------------- ### HTML5 Demo with my.alert JSAPI Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_platform_transform-html5.mdx A complete HTML5 example demonstrating the usage of the 'my.alert' JSAPI. It includes importing the SDK, setting up a button, and handling the alert API call with success, fail, and complete callbacks. This showcases a common pattern for interacting with mini-program functionalities. ```html Miniprogram JSAPI Demo
``` -------------------------------- ### Get Connected Bluetooth Devices Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Retrieves a list of currently connected Bluetooth devices. ```APIDOC ## Get Connected Bluetooth Devices ### Description Retrieves a list of currently connected Bluetooth devices. ### Method GET ### Endpoint /bluetooth/devices/connected ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **devices** (array) - A list of connected Bluetooth devices. - **deviceId** (string) - The ID of the connected device. - **name** (string) - The name of the connected device. #### Response Example ```json { "devices": [ { "deviceId": "device123", "name": "My Bluetooth Speaker" } ] } ``` ``` -------------------------------- ### Basic Page Configuration Example (JSON) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_framework_page_page-configuration.mdx A basic example demonstrating how to configure page-specific window settings using a JSON file. This includes setting an option menu icon, enabling title penetration, and defining the navigation bar button theme. ```json { "optionMenu": { "icon": "https://img.example.com/example.png" }, "titlePenetrate": "YES", "barButtonTheme": "light" } ``` -------------------------------- ### Bluetooth Device Discovery Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_onbluetoothadapterstatechange.mdx APIs for starting, stopping, and receiving information about discovered Bluetooth devices. ```APIDOC ## Bluetooth Device Discovery ### Description Allows the application to scan for nearby Bluetooth devices and retrieve a list of discovered devices. ### Method - `startBluetoothDevicesDiscovery` - `stopBluetoothDevicesDiscovery` - `onBluetoothDeviceFound` - `getBluetoothDevices` - `getConnectedBluetoothDevices` ### Parameters #### `startBluetoothDevicesDiscovery` - **allowDuplicatesKey** (boolean) - Optional. Set to `true` to allow duplicate devices in discovery results. - **success** (function) - Callback function for successful start of discovery. - **fail** (function) - Callback function for failure to start discovery. #### `stopBluetoothDevicesDiscovery` - **success** (function) - Callback function for successful stop of discovery. - **fail** (function) - Callback function for failure to stop discovery. #### `onBluetoothDeviceFound` - **success** (function) - Callback function triggered when a new device is found. Receives an object containing a `devices` array. - **fail** (function) - Callback function for errors during device discovery listening. #### `getBluetoothDevices` - **success** (function) - Callback function for successful retrieval of all discovered devices. Returns a `devices` array. - **fail** (function) - Callback function for failure to retrieve devices. #### `getConnectedBluetoothDevices` - **success** (function) - Callback function for successful retrieval of connected devices. Returns a `devices` array. - **fail** (function) - Callback function for failure to retrieve connected devices. ### Request Example ```javascript // Start discovering Bluetooth devices my.startBluetoothDevicesDiscovery({ allowDuplicatesKey: false, success: () => { my.onBluetoothDeviceFound({ success: res => { var deviceArray = res.devices; // Process found devices... }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); ``` ### Response #### Success Response (200) - **`onBluetoothDeviceFound`**: Receives an object with a `devices` array, where each element is a device object containing properties like `deviceId`, `name`, `RSSI`, etc. - **`getBluetoothDevices`**: Returns a `devices` array similar to `onBluetoothDeviceFound`. - **`getConnectedBluetoothDevices`**: Returns a `devices` array of currently connected devices. #### Response Example ```json { "devices": [ { "deviceId": "0D9C82AD-1CC0-414D-9526-119E08D28124", "name": "MyBluetoothDevice", "RSSI": -70, "advertisData": "..." } ] } ``` ``` -------------------------------- ### Get BLE Device Characteristics Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Retrieves the characteristics of a specific service on a connected BLE device. ```APIDOC ## Get BLE Device Characteristics ### Description Retrieves the characteristics of a specific service on a connected BLE device. ### Method GET ### Endpoint /ble/device/{deviceId}/services/{serviceId}/characteristics ### Parameters #### Path Parameters - **deviceId** (string) - Required - The ID of the BLE device. - **serviceId** (string) - Required - The ID of the service. ### Request Example ```json {} ``` ### Response #### Success Response (200) - **characteristics** (array) - A list of characteristics for the service. - **characteristicId** (string) - The ID of the characteristic. - **uuid** (string) - The UUID of the characteristic. - **properties** (object) - Properties of the characteristic (e.g., read, write, notify). #### Response Example ```json { "characteristics": [ { "characteristicId": "charXYZ", "uuid": "2a37", "properties": { "read": true, "write": false, "notify": true } } ] } ``` ``` -------------------------------- ### Bluetooth Initialization and State Management Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_onbluetoothadapterstatechange.mdx APIs for initializing, closing, and checking the state of the Bluetooth adapter. ```APIDOC ## Bluetooth Initialization and State Management ### Description Provides methods to manage the Bluetooth adapter, including opening, closing, and querying its current state. ### Method - `openBluetoothAdapter` - `closeBluetoothAdapter` - `getBluetoothAdapterState` ### Parameters #### `openBluetoothAdapter` - **success** (function) - Callback function for successful initialization. - **fail** (function) - Callback function for initialization failure. #### `closeBluetoothAdapter` - **success** (function) - Callback function for successful closure. - **fail** (function) - Callback function for closure failure. #### `getBluetoothAdapterState` - **success** (function) - Callback function for successful retrieval of state. Returns an object with `available` property. - **fail** (function) - Callback function for failure to retrieve state. ### Request Example ```javascript // Initialize Bluetooth adapter my.openBluetoothAdapter({ success: res => { if (!res.isSupportBLE) { my.alert({ content: 'Sorry, your mobile Bluetooth is unavailable temporarily' }); return; } my.alert({ content: 'Succeeded to initialize!' }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); ``` ### Response #### Success Response (200) - **`openBluetoothAdapter`**: Returns an object indicating if Bluetooth is supported (`isSupportBLE`). - **`getBluetoothAdapterState`**: Returns an object with a boolean `available` property indicating if the adapter is available. #### Response Example ```json { "isSupportBLE": true } ``` ```json { "available": true, "discovering": false } ``` ``` -------------------------------- ### Get Bind Function Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx A utility function to bind a method to the current instance if it hasn't been bound already. This ensures the correct `this` context when callbacks are invoked. ```javascript getBind(name) { if (!this[`bind${name}`]) { this[`bind${name}`] = this[name].bind(this); } return this[`bind${name}`]; } ``` -------------------------------- ### Initialize New Project with APMP CLI Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_command-line.mdx Initializes a new mini-program project using the APMP CLI. Supports specifying project type and name via command parameters or interactive prompts. ```bash # Input app type and name via command parameters apmp app create -t [mini-app] -n [appName] # Input the app type and name via inquirer Q&A apmp app create - project type > mini-app - app name : [app name] ``` -------------------------------- ### Notify BLE Characteristic Value Change Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_stopbluetoothdevicesdiscovery.mdx Starts or stops listening for changes in a Bluetooth characteristic's value. This is useful for receiving real-time data from a device. ```APIDOC ## POST /my/notifyBLECharacteristicValueChange ### Description Starts or stops listening for changes in a Bluetooth characteristic's value. This is useful for receiving real-time data from a device. ### Method POST ### Endpoint /my/notifyBLECharacteristicValueChange ### Parameters #### Request Body - **state** (boolean) - Required - Set to `true` to start listening, `false` to stop. - **deviceId** (string) - Required - The ID of the target Bluetooth device. - **serviceId** (string) - Required - The ID of the service to which the characteristic belongs. - **characteristicId** (string) - Required - The ID of the characteristic to listen for changes on. - **success** (Function) - Optional - Callback function for a successful operation. - **fail** (Function) - Optional - Callback function for a failed operation. ### Request Example ```json { "state": true, "deviceId": "some_device_id", "serviceId": "some_service_id", "characteristicId": "some_characteristic_id" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Write BLE Characteristic Value Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_ble_connectbledevice.mdx Writes a value to a specific characteristic for a connected BLE device. This function is incomplete in the provided snippet but demonstrates the initial setup to get connected devices. Dependencies include my.getConnectedBluetoothDevices. ```javascript writeBLECharacteristicValue() { my.getConnectedBluetoothDevices({ success: res => { if (res.devices.length === 0) { my.alert({ content: 'No connected devices' }); return; } this.setData({ ``` -------------------------------- ### Get Image Information (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_media_image_getimageinfo.mdx This JavaScript code demonstrates how to use the my.getImageInfo API to retrieve information about an image. It shows examples for network image paths, local file paths obtained via 'my.chooseImage', and relative paths. The success callback logs the image details to the console. Error handling is managed through optional 'fail' and 'complete' callbacks. ```javascript //Network picture path my.getImageInfo({ src:'https://img.example.com/example.jpg', success:(res)=>{ console.log(JSON.stringify(res)) } }) //apFilePath my.chooseImage({ success: (res) => { my.getImageInfo({ src:res.apFilePaths[0], success:(res)=>{ console.log(JSON.stringify(res)) } }) }, }) //Relative path my.getImageInfo({ src:'image/api.png', success:(res)=>{ console.log(JSON.stringify(res)) } }) ``` -------------------------------- ### Global Configuration for Mini Program in app.json Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_quick-start_learn-more-about-todo-app-demo.mdx The `app.json` file is used for the global configuration of a Mini Program. It allows setting the navigation bar title, window background color, and other general configurations. Page paths must be declared here, with the first path designated as the home page. ```json { "pages": [ "pages/todos/todos", "pages/add-todo/add-todo" ], "window": { "defaultTitle": "Todo App" } } ``` -------------------------------- ### HTML Input Component Examples Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_component_form-component_input.mdx Demonstrates various configurations of the HTML input component, including maxlength, placeholder, input synchronization, number types, password fields, and digit input. ```html ``` -------------------------------- ### Handle Newly Added Component Property in JavaScript and HTML Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_framework_compatibility.mdx This example shows how to handle a newly added property for a component. First, it checks the support for the property using `my.canIUse()` and stores the result in the page's data. Then, it conditionally renders the component with the new property or a fallback. ```javascript Page({ data: { canIUse: my.canIUse('button.open-type.share') } }) ``` ```html ``` -------------------------------- ### Move Path to Point with CanvasContext.moveTo (JavaScript) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_ui_canvas_canvas-context_canvascontext-moveto.mdx The moveTo method sets a new starting point for a path on the canvas. It takes x and y coordinates as parameters. This method is typically used in conjunction with other drawing methods like lineTo and stroke to define shapes. The example demonstrates moving the path and then drawing lines. ```javascript const ctx = my.createCanvasContext('awesomeCanvas') ctx.moveTo(10, 10) ctx.lineTo(100, 10) ctx.moveTo(10, 50) ctx.lineTo(100, 50) ctx.stroke() ctx.draw() ``` -------------------------------- ### Global Mini Program Configuration (app.json) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_quick-start_understand-the-mini-program-file-structure.mdx Demonstrates the structure of the app.json file, which configures global settings for a Mini Program. It includes the list of pages and window-specific properties like the title bar color and default title. ```json // app.json { "pages": [ "pages/todos/todos", "pages/add-todo/add-todo" ], "window": { "defaultTitle": "Todo App", "titleBarColor": "#323239" } } ``` -------------------------------- ### Notify BLE Characteristic Value Change Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_onbluetoothadapterstatechange.mdx Subscribes to changes in a BLE characteristic's value. It first gets connected devices, then sets up the notification. A success callback alerts 'Succeeded to listen', and a fail callback shows the error. It also includes an event listener for value changes. ```javascript my.notifyBLECharacteristicValueChange({ state: true, deviceId: this.data.devid, serviceId: this.data.serid, characteristicId: this.data.notifyId, success: () => { my.onBLECharacteristicValueChange({ success: res => { my.alert({ content: 'Obtain the response data = ' + res.value }); }, }); my.alert({ content: 'Succeeded to listen' }); }, fail: error => { my.alert({ content: 'Failed to listen' + JSON.stringify(error) }); }, }); ``` -------------------------------- ### JavaScript Bluetooth API Implementation Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_ble_onblecharacteristicvaluechange.mdx Implements various Bluetooth functionalities using a JavaScript API. This includes initializing the adapter, closing it, getting its state, starting and stopping device discovery, and handling device discovery events. It also includes placeholder functions for connecting, reading, and writing data, as well as managing connection states and events. ```javascript Page({ data: { devid: '0D9C82AD-1CC0-414D-9526-119E08D28124', serid: 'FEE7', notifyId: '36F5', writeId: '36F5', charid: '', alldev: [{ deviceId: '' }], }, //Obtain the Bluetooth state openBluetoothAdapter() { my.openBluetoothAdapter({ success: res => { if (!res.isSupportBLE) { my.alert({ content: 'Sorry, your mobile Bluetooth is unavailable temporarily' }); return; } my.alert({ content: 'Succeeded to initialize!' }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, closeBluetoothAdapter() { my.closeBluetoothAdapter({ success: () => { my.alert({ content: 'Bluetooth closed!' }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, getBluetoothAdapterState() { my.getBluetoothAdapterState({ success: res => { if (!res.available) { my.alert({ content: 'Sorry, your mobile Bluetooth is unavailable temporarily' }); return; } my.alert({ content: JSON.stringify(res) }); }, fail: error => { my.alert({ content: JSON.stringify(error) }); }, }); }, //Scan the Bluetooth device startBluetoothDevicesDiscovery() { my.startBluetoothDevicesDiscovery({ allowDuplicatesKey: false, success: () => { my.onBluetoothDeviceFound({ success: res => { // my.alert({content:'Listens to new device'+JSON.stringify(res)}); var deviceArray = res.devices; for (var i = deviceArray.length - 1; i >= 0; i--) { var deviceObj = deviceArray[i]; //Pair the target device with the device name or broadcast data, and then record the device ID for later use. if (deviceObj.name == this.data.name) { my.alert({ content: 'Target device is found' }); my.offBluetoothDeviceFound(); this.setData({ ``` -------------------------------- ### Preview App with APMP CLI Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_command-line.mdx Previews the currently selected mini-program project using the APMP CLI. Optional parameters include appId, workspaceId, and projectPath for specific configurations. ```bash # Use the currently selected project apmp app preview ``` -------------------------------- ### Cite Various Custom Components in Page JSON Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_framework_custom-component_use-custom-component.mdx This JSON snippet illustrates how to cite different types of custom components in a 'page.json' file. It includes examples for components installed via npm, local components using absolute paths, and local components using relative paths (e.g., './' and '../'). ```json // page.json Note that it is not configured in app.json { "usingComponents":{ "your-custom-component":"mini-antui/es/list/index", "your-custom-component2":"/components/card/index", "your-custom-component3":"./result/index", "your-custom-component4":"../result/index" } } // The project absolute path starts with /; the relative path starts with ./ or ../; the npm path does not start with / ``` -------------------------------- ### Mini Program AXML Structure Example Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_quick-start_understand-the-mini-program-file-structure.mdx Shows a basic example of an AXML (Mini Program Markup Language) structure, similar to HTML. It demonstrates how to bind data and apply conditional styling using double curly braces for rendering variables and executing simple operations. ```html {{number}} ``` -------------------------------- ### Permission Guide Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_api-reference.mdx Guides the user to grant necessary authorization. ```APIDOC ## POST /api/device/permissions/guide ### Description Guide the user to grant the authorization when the permission is needed. ### Method POST ### Endpoint /api/device/permissions/guide ### Parameters #### Request Body - **permission** (string) - Required - The permission to request authorization for (e.g., 'location', 'camera'). ### Request Example { "permission": "location" } ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` -------------------------------- ### App Configuration (app.json) Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_framework_app_overview.mdx Defines the structure and initial settings for a Mini Program. It specifies the pages included in the application and window-level configurations like the default title. This is a static JSON configuration file. ```json { "pages": [ "pages/index/index", "pages/logs/index" ], "window": { "defaultTitle": "Demo" } } ``` -------------------------------- ### Get File Info Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_file_getfileinfo.mdx Retrieves information about a specified file, such as its size and digest. You can optionally specify the digest algorithm. ```APIDOC ## GET /getFileInfo ### Description Retrieves information about a specified file, such as its size and digest. You can optionally specify the digest algorithm. ### Method GET ### Endpoint /getFileInfo ### Parameters #### Query Parameters - **apFilePath** (String) - Required - The path to the file. - **digestAlgorithm** (String) - Optional - The digest algorithm to use (e.g., 'md5', 'sha1'). Defaults to 'md5'. ### Request Example ```javascript my.getFileInfo({ apFilePath: 'https://resource/apml953bb093ebd2834530196f50a4413a87.video', digestAlgorithm: 'sha1', success: (res)=> { console.log(JSON.stringify(res)) } }) ``` ### Response #### Success Response (200) - **size** (Number) - The size of the file in bytes. - **digest** (String) - The calculated digest of the file. #### Response Example ```json { "size": 1024, "digest": "abcdef1234567890" } ``` ``` -------------------------------- ### Navigate Between Pages with my.navigateTo and my.navigateBack Source: https://context7.com/akarm13/qineo-docs/llms.txt The navigation APIs, including `my.navigateTo`, `my.navigateBack`, `my.redirectTo`, `my.switchTab`, and `my.reLaunch`, manage page transitions within the mini program. `my.navigateTo` allows navigating to a new page with parameters, while `my.navigateBack` returns to previous pages. The maximum navigation stack depth is 10 pages. ```javascript // Navigate to new page with parameters my.navigateTo({ url: '/pages/product/detail?productId=PROD_001&source=home', success: () => console.log('Navigation successful'), fail: (error) => console.error('Navigation failed:', error) }); // Receive parameters in target page Page({ onLoad(query) { console.log('Product ID:', query.productId); // 'PROD_001' console.log('Source:', query.source); // 'home' this.loadProductDetails(query.productId); } }); // Go back to previous page my.navigateBack({ delta: 1 // Go back 1 page (default) }); // Go back multiple pages my.navigateBack({ delta: 2 // Go back 2 pages }); // Redirect (replace current page, no back navigation) my.redirectTo({ url: '/pages/order/success?orderId=12345' }); // Switch to tab page my.switchTab({ url: '/pages/home/index' }); // Relaunch app (close all pages and open target) my.reLaunch({ url: '/pages/login/index' }); ``` -------------------------------- ### Start Bluetooth Devices Discovery Source: https://github.com/akarm13/qineo-docs/blob/main/docs/docs_miniprogram_qineo_mpdev_api_device_bluetooth_bluetooth_closebluetoothadapter.mdx Initiates the discovery of nearby Bluetooth devices. This function will start scanning for devices and register a callback for when devices are found. ```APIDOC ## POST /bluetooth/startDiscovery ### Description Starts the discovery of Bluetooth devices. It registers a callback to handle found devices and includes error handling for the discovery process. ### Method POST ### Endpoint /bluetooth/startDiscovery ### Parameters #### Query Parameters - **success** (function) - Optional - Callback function executed upon successful discovery start. - **fail** (function) - Optional - Callback function executed if discovery fails. ### Request Example ```javascript my.startBluetoothDevicesDiscovery({ success: res => { // Handle success }, fail: error => { // Handle error } }); ``` ### Response #### Success Response (200) Indicates that the discovery process has started successfully. Specific success data might be returned in the success callback. #### Response Example (Success is indicated by the execution of the success callback. No direct JSON response body for this action.) ```