A method for implementing mobile phone app debugging protection device and monitoring equipment
By creating a Bluetooth data analysis plug-in in the mobile app, and directly connecting the monitoring equipment and protection devices with the BLE Bluetooth module, the problem of debugging operations relying on network connections in the existing technology is solved, and stable and convenient equipment monitoring and troubleshooting are achieved.
Patent Information
- Application Number
- CN202310283144.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2043-03-21
AI Technical Summary
In the prior art, debuggers need to connect to the switch through a network to view and modify the operating status and setting parameters of the monitoring equipment and protection devices, resulting in inconvenient operation and limited by communication conditions, which is particularly difficult in industrial sites where communication is poor.
By creating a Bluetooth data analysis plug-in, using the BLE Bluetooth module to transmit data, the mobile app is directly connected to the protection device and monitoring device, subscribe to Bluetooth services and read and write data services, realize data analysis and transmission, and avoid network connection dependence.
It realizes a stable connection between mobile apps and protection devices and monitoring equipment, and is independent of on-site communication conditions, which facilitates debuggers to monitor and troubleshoot, simplifies the operation process, and improves adaptability and scalability.
Smart Images

Figure CN116405590B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electrical systems, and in particular to a method for implementing a mobile phone app debugging protection device and a monitoring device. Background Art
[0002] Many monitoring equipment and protection devices are installed in electrical industrial enterprises to monitor the operating status of on-site equipment and perform fault diagnosis. However, the applicant found that when the debugging personnel need to view the operating status and set parameters of the monitoring equipment and protection devices, as well as remotely control and send them, they all rely on the host computer (communication management machine). Therefore, the monitoring equipment and protection devices must be viewed and modified through the network (network connection switch). Therefore, when the debugging personnel monitor and troubleshoot the on-site monitoring equipment and protection devices, they need to carry the host computer and other equipment, which is troublesome and inconvenient. In addition, due to the limitations of on-site communication conditions, the connection stability is poor. Moreover, many industrial enterprises' equipment is set up in places where the communication network is not smooth, which causes great inconvenience to monitoring and troubleshooting. Summary of the invention
[0003] In order to solve the above problems existing in the prior art, the present invention provides a method for realizing a mobile phone app debugging protection device and a monitoring device.
[0004] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0005] In a first aspect, the present invention provides a method for implementing a mobile app debugging protection device and a monitoring device, comprising:
[0006] S1. Create a Bluetooth data analysis plug-in: Based on the capacitor cross-platform mobile application, a plug-in is built for data analysis based on the communication protocol, and built into the mobile app. The communication protocol is consistent with the communication protocol of the protection device and the monitoring equipment;
[0007] S2. Establish a connection between the mobile app and the BLE Bluetooth module of the protection device and monitoring equipment, and subscribe to the corresponding Bluetooth service and read and write data service;
[0008] S3. Matching mobile app protection devices and monitoring equipment point table;
[0009] S4. parse the debugging data packet of the protection device and / or the monitoring device through the Bluetooth data parsing plug-in, and transmit it to the protection device and / or the monitoring device.
[0010] Furthermore, the step S1 comprises:
[0011] 1-1. Use the npm package manager to generate a custom plug-in project and fill in the plug-in name, ID, author, URL, function description and other information;
[0012] 1-2. After generating the plug-in project, use Android Studio to open the Android folder under the installation package and develop a Bluetooth data analysis plug-in as an Android project. That is, complete the development of a custom Bluetooth data analysis plug-in code for the purpose of data analysis based on the communication protocol, including opening the communication link, converting data into frames and sending them to the BLE Bluetooth module of the protection device and monitoring equipment, obtaining data, reading and writing set values, remote control distribution, program upgrades, etc.;
[0013] 1-3. After the custom Bluetooth data parsing plug-in code is developed, add each method declaration in the corresponding Plugin class, and use PluginCall to define the execution result and return it to the format of the app;
[0014] 1-4. In definitions.ts of the plugin, declare the return interface format of each method, and the interface format is consistent with the format in the plugin class, which is used as the interface called by the mobile app;
[0015] 1-5. After the custom Bluetooth data parsing plug-in is developed, upload it to the npm plug-in library so that it can be referenced by the mobile app;
[0016] 1-6. Use verdaccio to build the npm plug-in library, set this address, point npm to the local npm plug-in library, and then publish the customized Bluetooth data parsing plug-in to the npm plug-in library;
[0017] 1-7. Download the customized Bluetooth data parsing plug-in from the npm plug-in library through the mobile app project, so that the mobile app can call the Bluetooth data parsing plug-in.
[0018] Furthermore, the step S2 comprises:
[0019] 2-1. Create an ionic project and install the cordova-plugin-bluetoothle Bluetooth plug-in;
[0020] 2-2. Set the Android permissions of the mobile phone, including enabling the Bluetooth permission, using the Bluetooth permission and using the mobile phone location permission;
[0021] 2-3. Start Bluetooth scanning in the mobile app, use the startScan method to scan the BLE Bluetooth modules of the protection device and monitoring equipment, obtain the addresses of all BLE Bluetooth modules, and connect to the corresponding BLE Bluetooth module through the address;
[0022] 2-4. After the mobile app is connected to the BLE Bluetooth module, configure the Bluetooth service and establish a communication subscription.
[0023] Furthermore, the “configuring Bluetooth services and establishing communication subscriptions” includes:
[0024] Configure the Bluetooth subscription service uuid to be used in the mobile app. You can configure multiple uuids according to different BLE Bluetooth modules, and add corresponding processing logic;
[0025] After connecting to the BLE module, use the discover method to find all the services of the BLE module. If the uuid of the subscription and read / write data service can be found in the built-in service of the mobile app, the service and the corresponding logic are used to subscribe and read / write data.
[0026] After successfully subscribing to the service, a protocol channel consistent with the communication protocol of the protection device and monitoring equipment is opened to facilitate subsequent analysis and processing of the data received and sent by the mobile phone APP Bluetooth.
[0027] Furthermore, the step S3 comprises:
[0028] 3-1. The point table of common protection devices and monitoring equipment is built into the mobile app; the name format of the point table is device model + version number;
[0029] 3-2. If the point table of the on-site protection device and monitoring equipment is not in the built-in point table of the mobile app, upload the point table file of the on-site protection device and monitoring equipment to the mobile app, and the name format of the uploaded point table is the same as step 3-1;
[0030] 3-3. When the mobile app is connected to the on-site protection device and monitoring equipment, it will automatically match the corresponding point table file.
[0031] Furthermore, in step 3-3, the mobile app connects to the on-site protection device and monitoring equipment, and in the automatic matching process after receiving the device model and version number returned by the protection device and monitoring equipment, if a matching device model is found in the point table, but there is no matching version number, the point table with the latest version number under the device model is selected for matching; if the current point table does not match, the point table is reselected from the point table file as the current point table.
[0032] The present invention has the following beneficial effects through the above technical solution:
[0033] 1. Data is transmitted through the BLE Bluetooth module, without the need to connect to a switch through the network, so that the mobile app can be stably connected to the protection device and monitoring equipment and is not restricted by the on-site communication conditions, which makes it convenient for on-site personnel to use the mobile app to monitor and troubleshoot the protection device and monitoring equipment when the communication is poor. The mobile app can be used to debug the protection device and monitoring equipment;
[0034] 2. All dispatching operations are performed on the mobile app. The commissioning personnel do not need to carry other extra tools. It is more convenient to check the operating status of the on-site protection device and monitoring equipment and perform maintenance operations;
[0035] 3. In view of the different Bluetooth modules of different protection devices and monitoring equipment, the mobile app supports the configuration of multiple services and characteristic uuids. At the same time, the point table files of different protection devices and monitoring equipment also support mobile app configuration, with strong compatibility and scalability, and can adapt to various field devices;
[0036] 4. After the mobile app connects to the BLE Bluetooth module of the protection device and the monitoring device, it will automatically adapt to the corresponding Bluetooth services and features, and automatically match the point table file according to the device model and version number. No user operation is required. It is extremely simple and convenient to use, and there is no need to consider redundant configuration;
[0037] 5. For protection devices and monitoring equipment that use different communication protocols, you can customize the capacitor plug-in of the corresponding protocol. You only need to replace the customized plug-in. The plug-in development has strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a flow chart of the method for implementing the mobile app debugging protection device and monitoring equipment according to the present invention;
[0039] Figure 2 It is a flow chart of creating a Bluetooth data parsing plug-in in the method for implementing a mobile app debugging protection device and a monitoring device according to an embodiment of the present invention;
[0040] Figure 3 It is a functional method diagram of the Bluetooth data parsing plug-in included in the method for implementing the mobile app debugging protection device and the monitoring device according to the embodiment of the present invention;
[0041] Figure 4 It is a flow chart of establishing a connection between a mobile phone app and a BLE Bluetooth module of a protection device and a monitoring device, subscribing to a corresponding Bluetooth service and reading and writing data services in a method for implementing a mobile phone app debugging a protection device and a monitoring device according to an embodiment of the present invention;
[0042] Figure 5 It is a flow chart of a method for realizing a mobile phone app debugging protection device and a monitoring device according to an embodiment of the present invention, in which a mobile phone app is connected to a Bluetooth device and successfully matched to a corresponding Bluetooth service. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0044] like Figure 1 As shown in the figure, the method of implementing a mobile app debugging protection device and monitoring equipment described in the present invention, the mobile app project construction and some basic startup applications and page composition of the present invention have detailed steps and instructions on the ionic framework official website, which will not be repeated in detail here. The most core key steps of the method described in the present invention are Bluetooth transmission, custom plug-ins, and data processing. The method specifically includes the following steps:
[0045] Step S1. Create a Bluetooth data analysis plug-in: Based on the capacitor cross-platform mobile application, a plug-in is built for the purpose of data analysis using the communication protocol, and the plug-in is built into the mobile app. The communication protocol is consistent with the communication protocol of the protection device and the monitoring device. For example, when the protection device and the monitoring device use the IEC-103 communication protocol, a plug-in is built based on the capacitor cross-platform mobile application for the purpose of data analysis using the IEC-103 communication protocol, and the plug-in is built into the mobile app. The step S2 specifically includes:
[0046] 1-1. Use the npm package manager to generate a custom plug-in project and fill in the plug-in name, ID, author, URL, function description and other information;
[0047] 1-2. After generating the plug-in project, use Android Studio to open the Android folder under the installation package and develop a Bluetooth data analysis plug-in as an Android project, that is, complete the development of a custom Bluetooth data analysis plug-in code for the purpose of data analysis based on the communication protocol, including opening the communication link, converting data into frames and sending them to the BLE Bluetooth module of the protection device and monitoring equipment, obtaining data (such as remote signaling and telemetry, etc.), reading and writing set values, remote control distribution, program upgrades, etc.;
[0048] 1-3. After the custom Bluetooth data parsing plug-in code is developed, add each method declaration in the corresponding Plugin class, and use PluginCall to define the execution result and return it to the format of the app;
[0049] 1-4. In definitions.ts of the plugin, declare the return interface format of each method, and the interface format is consistent with the format in the plugin class, which is used as the interface called by the mobile app;
[0050] 1-5. After the custom Bluetooth data parsing plug-in is developed, upload it to the npm plug-in library (you can choose to upload it to a public library or a private library) so that it can be referenced by the mobile app;
[0051] 1-6. Use verdaccio to build the npm plug-in library, set this address, point npm to the local npm plug-in library, and then publish the customized Bluetooth data parsing plug-in to the npm plug-in library;
[0052] Further, taking a private library as an example, the steps include:
[0053] (1) Use verdaccio to build NPM private library;
[0054] (2) Set the local address, that is, point npm to the local private plug-in library, so that the custom plug-in can be published to the private warehouse;
[0055] (3) Publish plugins:
[0056] 1-7. Download the customized Bluetooth data parsing plug-in from the npm plug-in library through the mobile app project, so that the mobile app can call the Bluetooth data parsing plug-in.
[0057] Step S2. Establish a connection between the mobile app and the BLE Bluetooth module of the protection device and the monitoring device, and subscribe to the corresponding Bluetooth service and read and write data service; specifically including:
[0058] 2-1. Create an ionic project and install the cordova-plugin-bluetoothle Bluetooth plug-in;
[0059] 2-2. Set the Android permissions of the mobile phone, including enabling the Bluetooth permission, using the Bluetooth permission and using the mobile phone location permission; these permissions are obtained or enabled in the mobile phone app through the following corresponding methods:
[0060] Request location permission: requestPermission();
[0061] Enable location permission: requestLocation();
[0062] Enable Bluetooth permission: bluetoothle.enable();
[0063] 2-3. Open Bluetooth scanning in the mobile app, use the startScan method to scan the BLE Bluetooth modules of the protection device and monitoring equipment (this step is not to open and connect Bluetooth in the mobile phone settings, because all data needs to be processed through the mobile app, so you must use the mobile app to connect the BLE Bluetooth modules of the protection device and monitoring equipment.), obtain the addresses of all BLE Bluetooth modules, and connect to the corresponding BLE Bluetooth module through the address;
[0064] 2-4. After the mobile app is connected to the BLE Bluetooth module, configure the Bluetooth service and establish a communication subscription; the "Configure Bluetooth service and establish a communication subscription" mentioned in the above includes:
[0065] Configure the Bluetooth subscription service uuid to be used in the mobile app. You can configure multiple uuids according to different BLE Bluetooth modules and add corresponding processing logic. For example, some Bluetooth modules limit 20-byte transmission, and the transmission speed of some modules is related to the configuration items.
[0066] After connecting to the BLE module, use the discover method to find all the services of the BLE module. If the uuid of the subscription and read / write data service can be found in the built-in service of the mobile app, the service and the corresponding logic are used to subscribe and read / write data.
[0067] After successfully subscribing to the service, a protocol channel (such as the 103 protocol channel) that is consistent with the communication protocol of the protection device and monitoring equipment (such as the IEC-103 communication protocol) is opened to facilitate subsequent analysis and processing of the data received and sent by the mobile phone APP Bluetooth.
[0068] Step S3. Match the point table of the protection device and monitoring equipment of the mobile app, realize the classified management of the point table of various protection devices and monitoring equipment in the mobile app, and analyze and display the data of remote signaling, telemetry, setting, remote control, etc. according to the point address; specifically include:
[0069] 3-1. The point table of common protection devices and monitoring equipment is built into the mobile app; the name format of the point table is device model + version number;
[0070] 3-2. If the point table of the on-site protection device and monitoring equipment is not in the built-in point table of the mobile app, upload the point table file of the on-site protection device and monitoring equipment to the mobile app, and the name format of the uploaded point table is the same as step 3-1;
[0071] 3-3. When the mobile app is connected to the on-site protection device and monitoring equipment, the corresponding point table file is automatically matched; the principle of automatic matching is that after the mobile app is connected to the protection device and monitoring equipment, the first frame will return the device model and version number message, and the point table file name format is device model + version number, so after the message is parsed, it can be determined which point table it is, which is described in detail in the following embodiment.
[0072] Step S4. parse the debugging data packet of the protection device and / or monitoring device through the Bluetooth data parsing plug-in and transmit it to the protection device and / or monitoring device. In this process, the Bluetooth data parsing plug-in determines the device model and version number according to the reset frame returned by the protection device and / or monitoring device, and automatically uses the corresponding point table to parse and process the returned data according to the point table information. For example, when the protection device and / or monitoring device version is upgraded, remotely sent, and fixed value is modified on the mobile phone app, the following steps are included:
[0073] (1) The upgrade package bin file needs to be uploaded to the mobile app. The mobile app uses a custom Bluetooth data parsing plug-in to use the communication protocol to parse the upgrade package into corresponding data packets, and then sends them frame by frame to the BLE Bluetooth module of the corresponding protection device and monitoring device through Bluetooth frame transmission. After the transmission is completed, the protection device and / or monitoring device assembles the package for parsing and completes the upgrade;
[0074] (2) Control operations such as remote control are all sent to the custom plug-in through commands, which are parsed into corresponding frames and sent down. After the device completes the operation, the plug-in will return the execution result.
[0075] The method for realizing debugging protection devices and monitoring equipment by mobile phone app of the present invention, on the one hand, transmits data through BLE bluetooth module, without the need to connect to a switch through the network, so that the connection between mobile phone app and protection devices and monitoring equipment is stable and not limited by on-site communication conditions, which is convenient for on-site personnel to use mobile phone APP to monitor and troubleshoot protection devices and monitoring equipment when communication is poor, thereby realizing debugging of protection devices and monitoring equipment by mobile phone app; on the other hand, all scheduling operations are performed on mobile phone app, and debugging personnel do not need to carry other unnecessary tools, which makes it more convenient to check the operating conditions of on-site protection devices and monitoring equipment and perform maintenance operations; on the third hand, Bluetooth modules for different protection devices and monitoring equipment are used The mobile app supports configuring uuids of multiple services and features. At the same time, the point table files of different protection devices and monitoring equipment also support mobile app configuration. It has strong compatibility and scalability and can adapt to various on-site devices. Fourthly, after the mobile app connects to the BLE Bluetooth module of the protection device and monitoring equipment, it will automatically adapt to the corresponding Bluetooth services and features, and automatically match the point table file according to the device model and version number. No user operation is required. It is extremely simple and convenient to use, and there is no need to consider redundant configuration. Fifthly, for protection devices and monitoring equipment that use different communication protocols, you can customize the capacitor plug-in of the corresponding protocol. You only need to replace the custom plug-in, and the plug-in development has strong scalability.
[0076] In a possible implementation, in step 3-3, the mobile app connects to the on-site protection device and monitoring equipment, and in the automatic matching process after receiving the device model and version number returned by the protection device and monitoring equipment, if a matching device model is found in the point table, but there is no matching version number, then the point table with the latest version number under the device model is selected for matching; if the current point table does not match, then the point table is reselected from the point table file as the current point table. In this way, the method of the present invention can further improve the applicability of regulating various protection devices and monitoring equipment, and is more convenient to use.
[0077] The following is a further explanation of the method for implementing the mobile app debugging protection device and monitoring equipment described in the present invention through embodiments.
[0078] The accompanying drawings of the embodiments of the present invention take the HC-42 Bluetooth module and the IEC-103 communication protocol as examples. When the protection device and the monitoring equipment use other Bluetooth modules or other communication protocols, the technical solutions in the embodiments can be fully referred to. Only the configuration and the customized Bluetooth data parsing plug-in need to be changed. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0079] The method for implementing the mobile app debugging protection device and monitoring equipment described in this embodiment uses the following technologies:
[0080] Ionic mobile app development framework;
[0081] V5.0 BLE Bluetooth transmission protocol;
[0082] IEC-103 communication protocol capacitor custom plug-in.
[0083] The method for implementing the mobile app debugging protection device and monitoring equipment described in this embodiment is as follows:
[0084] First, if Figure 2 As shown in the figure, build your own custom Bluetooth data parsing plug-in based on capacitor. The function of this plug-in is to parse Bluetooth data, that is, to open the 103 protocol channel through the plug-in code, convert the data of the mobile app and the device into message frame data in the fixed format of the 103 protocol for Bluetooth transmission, and parse the message data into plain text for display and analysis on the mobile app. After the plug-in is written, it needs to be built into the mobile app.
[0085] This example mainly describes how to develop and use a custom plug-in. The plug-in method content is mainly based on the IEC-103 protocol related methods. Different protocols are similar to it. Basically, it needs to include Figure 3 Some functional methods in; the custom method for building a Bluetooth data parsing plug-in includes the following steps:
[0086] 1. Use the npm package manager to generate a plug-in template (for example, use the command "npm init@capacitor / plugin" to generate a custom plug-in project). You need to fill in the plug-in name, ID, author, URL, and function description;
[0087] 2. After generating the plug-in project, use Android Studio to open the Android folder under the installation package and develop your own plug-in as an Android project;
[0088] 3. Here we develop a plug-in for the purpose of data parsing based on the 103 protocol, including opening the 103 link, converting data into frames and sending them to Bluetooth, obtaining remote signaling, telemetry and other data, reading and writing fixed values, remote control distribution, program upgrades, etc. For details, see Figure 3 ;
[0089] 4. After the plug-in code is developed, add each method declaration in the corresponding Plugin class;
[0090] 5. Declare the return interface format of each method in definitions.ts of the plugin. Note that the format is consistent with that in the plugin class, which is used as the interface called by the APP end;
[0091] 6. After the custom plug-in is developed, it needs to be uploaded to the npm plug-in library before it can be referenced. You can choose to upload it to a public library or a private library. The npm public library is public and can be used by all developers. If the plug-in design team is confidential, it is recommended to publish it to a private library. Here we take the local private library as an example;
[0092] 7. Use verdaccio to build NPM private library;
[0093] npm install --global verdaccio;
[0094] verdaccio;
[0095] 8. Enter verdaccio to start the local private plug-in library created. The default port number is 4873 (it can also be changed manually);
[0096] 9. Point npm to the local private plug-in library so that custom plug-ins can be published to the private warehouse;
[0097] npm set registry http: / / localhost:4873 / ;
[0098] 10. Release plugins;
[0099] npm login;
[0100] npm publish;
[0101] 11. Download the custom plug-in through the private library in the APP project, and then call the plug-in method directly in the APP.
[0102] Then, based on the ionic framework, the mobile app is connected to the BLE Bluetooth module, subscribing to the corresponding service and reading and writing data, such as Figure 4 As shown, the specific steps include:
[0103] 1. Create an ionic project and install the cordova-plugin-bluetoothle Bluetooth plug-in.
[0104] 2. After the mobile phone APP is started, the Bluetooth plug-in is initialized first: bluetoothle.initialize().
[0105] 3. Set the Android permissions on your phone, that is, check and set the Android permissions: BLE Bluetooth requires turning on the Bluetooth permissions on your phone, using Bluetooth permissions, and using the phone's positioning permissions.
[0106] 4. Use bluetoothle.isEnabled() to check whether the phone's Bluetooth is turned on; if not, call bluetoothle.enable() to turn it on.
[0107] 5. After all relevant permissions are obtained normally, you can start Bluetooth scanning in the app and use the startScan method to scan nearby Bluetooth devices (i.e. the BLE Bluetooth modules of the protection device and monitoring device).
[0108] 6. After scanning, you can get the addresses of all nearby Bluetooth devices, select the device you want to connect to, and call connect() to connect to the Bluetooth device through the address.
[0109] 7. After the connection is successful, call discover() to obtain all Bluetooth services of the current device, because services with subscription and read-write characteristics in the Bluetooth module are required to communicate.
[0110] 8. Since different types of Bluetooth devices have different Bluetooth modules, you need to detect the Bluetooth service after connecting the Bluetooth device. Only through the corresponding Bluetooth service can you establish a communication subscription. The method is:
[0111] First, configure the Bluetooth subscription service uuid to be used in the mobile app. You can configure multiple ones according to different Bluetooth modules. Note that the uuid of the characteristics under the service should also be configured, such as:
[0112] serviceUUID:'FFE0', service uuid;
[0113] writeCharateristicUUID:'FFE1', read and write data characteristic uuid;
[0114] notifyCharateristicUUID:'FFE1' Subscribe to notification characteristic uuid;
[0115] Search the system's built-in serviceUUID from the service list obtained from the currently connected Bluetooth. If a matching uuid is found, it is the serviceUUID of the currently connected Bluetooth device, and the characteristic uuids of subscription and reading and writing are automatically determined. These two characteristics can be used to receive and send Bluetooth data respectively.
[0116] Because the system can have multiple serviceUUIDs of Bluetooth modules built in, and because each different Bluetooth module uses a different communication-related service UUID, the above method can be used to obtain the system-configured service UUID from the current service list. If it is obtained, it must be the service of the current Bluetooth module; if no match is found, it means that the connected device is using a new Bluetooth module. At this time, the Bluetooth service and characteristics must be configured in the mobile app.
[0117] 9. Use the subscription notification characteristic 'notifyCharateristicUUID' to subscribe to the Bluetooth service to receive data sent to the mobile app via Bluetooth.
[0118] 10. Use the read-write characteristic 'writeCharateristicUUID' to send commands and data sent through the custom plugin to the Bluetooth device.
[0119] Then, if Figure 5 As shown, when the mobile app is connected to Bluetooth and successfully matches the corresponding Bluetooth service, execute the following method:
[0120] 1. Call the initialization protocol method written in the custom plug-in to open the 103 protocol link;
[0121] 2. Enable Bluetooth subscription notification service, bleService.subscribeService();
[0122] 3. In the subscription method, the data returned by the Bluetooth device via Bluetooth will be received in real time. The received data is a data packet that complies with the 103 protocol. The data needs to be parsed by the custom plug-in before it can be converted into plain text information displayed by the mobile app. Therefore, each time the data is received in the subscription method, it needs to be handed over to the custom plug-in for processing;
[0123] 4. According to the 103 protocol, the first frame of the Bluetooth device will return basic information such as its model and version number. After the mobile app obtains the parsed information, it finds the corresponding point table from the point table file library of the mobile app through the model and version number and loads it as the current point table. After that, the data can be displayed after normal parsing according to the point table.
[0124] After that, the mobile app and the Bluetooth device can interact normally. The debugger only needs to operate the mobile app to parse the debugging data packet through the Bluetooth data parsing plug-in and transmit it to the Bluetooth device to complete the debugging of the Bluetooth device.
[0125] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for implementing a mobile app debugging protection device and a monitoring device, characterized in that: include: S1. Create a Bluetooth data analysis plug-in: Based on the capacitor cross-platform mobile application, a plug-in is built for data analysis based on the communication protocol, and built into the mobile app. The communication protocol is consistent with the communication protocol of the protection device and the monitoring equipment; including: 1-1. Use the npm package manager to generate a custom plug-in project and fill in the plug-in name, ID, author, URL and function description; 1-2. After generating the plug-in project, use Android Studio to open the Android folder under the installation package and develop a Bluetooth data analysis plug-in as an Android project. That is, complete the development of a custom Bluetooth data analysis plug-in code for the purpose of data analysis based on the communication protocol, including opening the communication link, converting data into frames and sending them to the BLE Bluetooth module of the protection device and monitoring equipment, obtaining data, reading and writing set values, remote control distribution, program upgrades, etc.; 1-3. After the custom Bluetooth data parsing plug-in code is developed, add each method declaration in the corresponding Plugin class, and use PluginCall to define the execution result and return it to the format of the app; 1-4. In definitions.ts of the plugin, declare the return interface format of each method, and the interface format is consistent with the format in the plugin class, which is used as the interface called by the mobile app; 1-5. After the custom Bluetooth data parsing plug-in is developed, upload it to the npm plug-in library so that it can be referenced by the mobile app; 1-6. Use verdaccio to build the npm plug-in library, set this address, point npm to the local npm plug-in library, and then publish the customized Bluetooth data parsing plug-in to the npm plug-in library; 1-7. Download the customized Bluetooth data analysis plug-in from the npm plug-in library through the mobile app project, so that the mobile app can call the Bluetooth data analysis plug-in; S2. Establish a connection between the mobile app and the BLE Bluetooth module of the protection device and monitoring equipment, and subscribe to the corresponding Bluetooth service and read and write data service; S3. A table of points for protection devices and monitoring equipment matching the mobile app; including: 3-1. The point table of common protection devices and monitoring equipment is built into the mobile app; the name format of the point table is device model + version number; 3-2. If the point table of the on-site protection device and monitoring equipment is not in the built-in point table of the mobile app, upload the point table file of the on-site protection device and monitoring equipment to the mobile app, and the name format of the uploaded point table is the same as step 3-1; 3-3. When the mobile app is connected to the on-site protection device and monitoring device, the corresponding point table file is automatically matched; in step 3-3, the mobile app is connected to the on-site protection device and monitoring device, and in the automatic matching process after receiving the device model and version number returned by the protection device and monitoring device, if a matching device model is found in the point table, but there is no matching version number, the point table with the latest version number under the device model is selected for matching; if the current point table does not match, the point table is re-selected from the point table file as the current point table; S4. parse the debugging data packet of the protection device and / or the monitoring device through the Bluetooth data parsing plug-in, and transmit it to the protection device and / or the monitoring device.
2. The method according to claim 1, characterized in that The step S2 comprises: 2-1. Create an ionic project and install the cordova-plugin-bluetoothle Bluetooth plug-in; 2-2. Set the Android permissions of the mobile phone, including enabling the Bluetooth permission, using the Bluetooth permission and using the mobile phone location permission; 2-3. Start Bluetooth scanning in the mobile app, use the startScan method to scan the BLE Bluetooth modules of the protection device and monitoring equipment, obtain the addresses of all BLE Bluetooth modules, and connect to the corresponding BLE Bluetooth module through the address; 2-4. After the mobile app is connected to the BLE Bluetooth module, configure the Bluetooth service and establish a communication subscription.
3. The method according to claim 2, characterized in that The "configure Bluetooth service and establish communication subscription" includes: Configure the Bluetooth subscription service uuid to be used in the mobile app. You can configure multiple uuids according to different BLE Bluetooth modules, and add corresponding processing logic; After connecting to the BLE module, use the discover method to find all the services of the BLE module. If the uuid of the subscription and read / write data service can be found in the built-in service of the mobile app, the service and the corresponding logic are used to subscribe and read / write data. After successfully subscribing to the service, a protocol channel consistent with the communication protocol of the protection device and monitoring equipment is opened to facilitate subsequent analysis and processing of the data received and sent by the mobile phone APP Bluetooth.
Citation Information
Patent Citations
Bluetooth mobile debugging method for converter and system
CN111479249A
Remote point table maintenance method based on terminal debugging device
CN114398862A