Method, device and product for realizing OpenHarmony system soft bus on Android platform
By registering Android soft bus services on the Android platform, integrating CoAP protocol, porting encryption and decrypting libraries and defining network functions, the problem of the inability to interconnect and openHarmony devices is solved, and high-speed, stable communication and seamless docking between devices are achieved. , improving communication efficiency and ecological expansion.
Patent Information
- Application Number
- CN202411427436.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology failed to implement OpenHarmony distributed soft bus technology on the Android platform, resulting in the inability to interconnect Android devices and OpenHarmony devices, limiting the ability to work collaboratively and data transmission.
Register the resident Android soft bus service on the Android platform, integrate the CoAP protocol for device discovery, port the encryption and decryption library of the OpenHarmony open source warehouse for device authentication, realize multi-device networking through defined functions and constants, and provide TCP session management and Data transmission interface ensures high-speed and stable communication between devices.
It realizes seamless docking and interconnection between Android devices and OpenHarmony devices, improves communication efficiency, expands the boundaries of the Android ecosystem, simplifies data exchange and collaborative work, and enables Android devices to make full use of the API provided by distributed soft buses.
Smart Images

Figure CN118939349A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method, device and product for implementing an OpenHarmony system soft bus on an Android platform. Background Art
[0002] OpenHarmony is an open source operating system launched by Huawei, which aims to create a unified and smooth user experience among smart devices. It is based on a microkernel architecture, which is not only flexible and changeable, but also has strong scalability, supporting a variety of device types including smartphones, tablets, smart TVs, smart wearable devices, etc.
[0003] Among the many functions of OpenHarmony, its distributed soft bus technology is the core module for interconnection between devices. As a bridge for communication between devices, the soft bus can efficiently transmit data and messages, allowing different devices to work together seamlessly to complete tasks. This technology ensures smooth communication between different devices, whether they are of the same type or different types, by providing a unified interface and protocol.
[0004] However, there is a prerequisite for achieving interoperability between devices, that is, the operating system on the device side must be an OpenHarmony system or a secondary development system based on OpenHarmony. At present, on the mobile side of the Internet of Things, the Android operating system occupies a prominent position with its broad user base and strong ecological advantages. Therefore, how to implement the OpenHarmony distributed soft bus technology on the Android platform has become a question worth exploring.
[0005] At present, there is no precedent in the field of technology for integrating the OpenHarmony soft bus base on the Android platform. Since Android devices lack the support of the OpenHarmony soft bus base, they cannot communicate with OpenHarmony devices through the soft bus. This situation limits the interconnection and interoperability between Android devices and OpenHarmony devices, resulting in obstacles in the collaborative work and data transmission between the two. Summary of the invention
[0006] The purpose of the present invention is to provide a method, device and product for implementing the OpenHarmony system soft bus on the Android platform, so that the Android system can be perfectly compatible with and run the OpenHarmony soft bus, thereby enabling Android devices to seamlessly connect with OpenHarmony devices and achieve interconnection between devices.
[0007] In order to achieve the above object, the technical solution of the present invention is as follows: A method for implementing an OpenHarmony system soft bus on an Android platform, comprising: S1. Register the resident Android soft bus service in the Android system; S2. After the Android soft bus service is initialized, the device discovery function is started. The device discovery function integrates the coap protocol and is used for mutual discovery between Android devices and OpenHarmony devices. S3. After the device is discovered, the device authentication function is started. The device authentication function transplants the encryption and decryption library in the OpenHarmony open source warehouse to achieve authentication and intercommunication with the OpenHarmony device; S4. After device authentication, multi-device connection management is performed through the connection function; S5. Start the device networking function and achieve seamless networking among multiple devices including OpenHarmony devices by defining functions and constants for network device management. S6. Provides data transmission function, provides tcp_session management and tcp_session-based execution data receiving and sending interface to the Android system, and realizes high-speed and stable data transmission between devices.
[0008] Furthermore, the device discovery function described in step S2 specifically includes: setting the CoAP sub-module to integrate the coap protocol and embedding it into the system in the form of a dynamic link library; providing a StartDiscovery interface, performing initialization operations through the StartDiscovery interface and calling StartDiscoveryInner for configuration; calling the ServerIpcStartDiscovery interface to prepare for inter-process communication; sending instructions through the StartDiscoveryInner interface, calling the CoapPackToPdu function to activate the CoAP sub-module; after the CoAP sub-module is activated, use the coap_send function to encapsulate data and send a unicast response message to complete the update of device information.
[0009] Furthermore, step S3 specifically includes: creating auth_conn.c to implement the functions of sending, receiving, authenticating and obtaining keys, creating auth_interface.c to manage sessions, links, key nodes, and provide add, delete, modify and query functions; creating wifi_auth_manager.c to implement data encryption and decryption, and device authentication.
[0010] Furthermore, the functions defined in step S5 specifically include: JoinLNN allows the device to access the local network node of a specific device; JoinMetaNode enables the device to join the specified meta node; LeaveLNN is used for the device to exit the local network node; LeaveMetaNode enables the device to exit the meta node; egNodeDeviceStateCb sets a monitor to be notified when the device status changes; PubLNN allows service information to be published on the local network node; SubLNN allows subscription to services on the local network node.
[0011] Another aspect of the present invention provides a device for implementing an OpenHarmony system soft bus on an Android platform, comprising: Android soft bus module: registered in the Android system as a service, registered as a resident Android soft bus service; Discovery module: integrates the coap protocol for mutual discovery between Android devices and OpenHarmony devices; Authentication module: transplant the encryption and decryption library in the OpenHarmony open source repository to achieve authentication and intercommunication with OpenHarmony devices; Connection module: multi-device connection management after device authentication; Networking module: By defining functions and constants for network device management, it enables seamless networking among multiple devices including OpenHarmony devices. Data transmission module: provides tcp_session management and tcp_session-based execution data receiving and sending interface to the Android system, realizing high-speed and stable data transmission between devices.
[0012] Furthermore, the discovery module includes: Interface submodule: Provides the StartDiscovery interface, performs initialization operations through the StartDiscovery interface and calls StartDiscoveryInner for configuration; calls the ServerIpcStartDiscovery interface of the proxy submodule to prepare for inter-process communication; Proxy submodule: provides the ServerIpcStartDiscovery interface for the interface submodule, and sends instructions to the discovery service terminal module through the StartDiscoveryInner interface; Service terminal module: after receiving the instruction, activates the CoAP submodule by calling the CoapPackToPdu function; CoAP submodule: Integrates the coap protocol and is embedded in the system in the form of a dynamic link library; after activation, it uses the coap_send function to encapsulate data and send a unicast response message to complete the update of device information.
[0013] Furthermore, the authentication module includes: creating auth_conn.c to provide the functions of sending, receiving, authenticating and obtaining keys, creating auth_interface.c to manage sessions, links, key nodes, and provide add, delete, modify and query functions; creating wifi_auth_manager.c to implement data encryption and decryption, and device authentication.
[0014] Furthermore, the functions defined in the networking module include: JoinLNN allows the device to access the local network node of a specific device; JoinMetaNode enables the device to join the specified meta node; LeaveLNN is used for the device to exit the local network node; LeaveMetaNode enables the device to exit the meta node; egNodeDeviceStateCb sets a monitor to be notified when the device status changes; PubLNN allows service information to be published on the local network node; SubLNN allows subscription to services on the local network node.
[0015] The present invention also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned method for implementing the OpenHarmony system soft bus on the Android platform.
[0016] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned method for implementing the OpenHarmony system soft bus on the Android platform.
[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention integrates the OpenHarmony soft bus base into devices running the Android system and makes it compatible, thereby opening up the core functions of the Android soft bus in the Android system, such as discovery connection, device networking, and data interaction, so that Android devices can also make full use of the API provided by the distributed soft bus to achieve high-speed communication between devices without having to pay attention to cumbersome communication details.
[0018] 2. The Android soft bus technology proposed in the present invention brings more possibilities to the Android platform, enabling Android devices to seamlessly connect with other OpenHarmony-based devices, further expanding the boundaries of the Android ecosystem.
[0019] 3. The present invention greatly improves the communication efficiency between Android devices and enables the business platform to be deployed and operated more efficiently. Through the Android soft bus technology, Android devices can build a more flexible and stable device network, making data exchange and collaborative work simpler and more efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a timing diagram of a discovery module according to an embodiment of the present invention; Figure 2 is a schematic diagram of the authentication module architecture of an embodiment of the present invention; Figure 3 is a schematic diagram of a networking module according to an embodiment of the present invention; Figure 4 is a schematic diagram of the data transmission module architecture of an embodiment of the present invention; Figure 5 is a schematic diagram of a newly added Android soft bus service in an embodiment of the present invention; Figure 6 It is a schematic diagram of the overall framework of an embodiment of the present invention; Figure 7 is a schematic diagram of discovery and networking according to an embodiment of the present invention; Figure 8 This is a schematic diagram of authentication, connection, and data transmission according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0022] The design idea of the present invention is to integrate the OpenHarmony soft bus base and make it compatible with devices running the Android system. Since it is a brand-new distributed soft bus implemented on the Android platform based on the OpenHarmony soft bus technology, it can be called the "Android soft bus". It opens up the core functions of the Android soft bus in the Android system, such as discovery connection, device networking, and data interaction, so that Android devices can also make full use of the API provided by the distributed soft bus to achieve high-speed communication between devices without having to pay attention to cumbersome communication details.
[0023] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0024] Based on the design concept, the present invention provides a method for implementing the OpenHarmony system soft bus on the Android platform, comprising the following steps: S1: During the Android system startup process, support the design and maintenance of a resident Android soft bus service. This service will become the core bridge for interaction between Android devices and OpenHarmony devices, ensuring the reliability and security of communication between devices.
[0025] The implementation principle of this step is that in the Android boot process, after starting to the init process, the systemserver process will be pulled up, which will start all the key services of the Android system. The services registered here will be added to the keep-alive set. For example, the window management service, package management service, power service, etc. Registering the Android soft bus service in the systemserver ensures the reliability and stability of communication between devices and avoids communication failures caused by service interruptions.
[0026] S2: After initialization, the Android Softbus service will start the device discovery function to ensure that Android devices and OpenHarmony devices can discover each other and obtain the encrypted information of each other's devices, providing a basis for subsequent connection and communication.
[0027] In this step, the device discovery function is implemented by integrating the coap protocol and embedded in the system in the form of a dynamic link library (.so library). Figure 1 As shown, the device discovery function provides the StartDiscovery interface through the interface submodule, performs initialization operations through the StartDiscovery interface and calls StartDiscoveryInner for configuration, and calls the ServerIpcStartDiscovery interface of the proxy submodule to prepare for inter-process communication; sends instructions to the discovery service terminal module through the StartDiscoveryInner interface of the proxy submodule; after receiving the instructions, the service terminal module activates the CoAP submodule by calling the CoapPackToPdu function; after the CoAP submodule is activated, the coap_send function is used to encapsulate data and send a unicast response message to complete the update of device information.
[0028] S3: After device discovery, start the device authentication function to ensure a secure connection between devices.
[0029] This step can provide the functions of sending, receiving, authenticating and obtaining keys, and perform security authentication on the OpenHarmony device that is about to be connected. The specific implementation logic is to create auth_conn.c to provide the functions of sending, receiving, authenticating and obtaining keys, create auth_interface.c to manage sessions, links, key nodes, and provide add, delete, modify and query functions; finally, create wifi_auth_manager.c to implement data encryption and decryption, and device authentication. In order to achieve authentication and interoperability with Openharmony devices, this function transplants the encryption and decryption library in the Openharmony open source warehouse to achieve the same frequency of encryption and decryption for both parties. For the specific process, see Figure 2 .
[0030] S4: After completing device authentication, multiple device connections can be managed through the connection function.
[0031] After completing the authentication and obtaining the key through auth_conn.c in step S3, the encrypted information of the discovered OpenHarmony device is decrypted and the connection operation is completed. In this step, a msg_get_deviceid.c file is created and maintained to obtain the information of each discovered OpenHarmony device in cJSON format, including device id, link information, device name, device type, etc., and then the data is packaged and stored to achieve connection management of OpenHarmony devices.
[0032] S5: Enables the device networking function between multiple devices to provide support for more complex collaborative work scenarios.
[0033] This step supports networking and realizes the topology structure through node management and control. The key functions and constants of Android softbus network device management are defined through softbus_bus_center.h to realize the monitoring functions of device addition, deletion, and network status and information changes. The important function declarations are as follows: JoinLNN allows a device to join a specific device's local network node.
[0034] JoinMetaNode Makes the device join the specified meta node.
[0035] LeaveLNN is used by a device to exit a local network node.
[0036] LeaveMetaNode causes the device to leave the meta node.
[0037] RegNodeDeviceStateCb Set up a listener to be notified when the device state changes.
[0038] PubLNN allows publishing service information on local network nodes.
[0039] SubLNN allows subscription services on local network nodes. Each device joins the network through the above function interface and becomes a node.
[0040] Multiple devices form a topology. For detailed process, see Figure 3 .
[0041] S6: After device discovery, connection and networking, it provides efficient and stable data transmission function to ensure high-speed and stable data transmission between devices.
[0042] In this step, the Android system is provided with tcp_session management and an execution data receiving and sending interface based on tcp_session, and TCP protocol is used through tcp_socket.c for more secure and reliable communication. For the specific process, see Figure 4 .
[0043] Based on the above method, the Android soft bus to be implemented by the present invention includes: Android soft bus module: The Android soft bus module is the core service component in the Android soft bus system, providing a stable and reliable operating environment and necessary guarantees for other modules. Through centralized management and control, the stability and security of the entire soft bus system are ensured. The Android soft bus module is registered in the system server as a service and becomes the Android soft bus service. The Android soft bus service is designed as a resident keep-alive service to ensure the reliability and stability of communication between devices and avoid communication failures caused by service interruptions.
[0044] Discovery module: The discovery module is used to implement the device discovery function and is responsible for finding and identifying other OpenHarmony devices in a specific environment. The discovery module realizes mutual discovery between devices through various methods such as broadcasting, scanning or monitoring network ports; the discovery module includes: interface submodule: provides StartDiscovery interface, performs initialization operations through StartDiscovery interface and calls StartDiscoveryInner for configuration; calls ServerIpcStartDiscovery interface of proxy submodule to prepare for inter-process communication; proxy submodule: provides ServerIpcStartDiscovery interface for interface submodule, and sends instructions to discovery service terminal module through its own StartDiscoveryInner interface; service terminal module: after receiving the instruction, activates CoAP submodule by calling CoapPackToPdu function; CoAP submodule: integrates coap protocol and embeds into the system in the form of dynamic link library; after activation, uses coap_send function to encapsulate data and send unicast response message to complete the update of device information.
[0045] Authentication module: The authentication module is used to implement the device authentication function and is responsible for the authentication and authorization process between devices. The authentication module ensures that only legitimate devices can access the network through key exchange, certificate verification, etc., to ensure the security of communication.
[0046] Connection module: The connection module is used to implement the connection function and is responsible for establishing and managing the communication connection between the Android device and the OpenHarmony device. The connection module selects appropriate communication protocols and parameters according to actual needs to ensure the efficiency and stability of the connection.
[0047] Networking module: The networking module is used to implement the networking function of the device and is responsible for implementing the networking and management functions of the device. The networking module defines the networking protocols and strategies between devices, supports multiple networking modes and topologies, and realizes collaborative work and data sharing between multiple devices.
[0048] Data transmission module: The data transmission module is used to implement the data transmission function and is responsible for efficient and stable data transmission between Android devices and OpenHarmony devices. The transmission module uses the established connection and authentication mechanism to ensure secure and reliable data transmission.
[0049] The working steps of the Android soft bus include: 1: After starting the initialization process, Figure 5 As shown, start the Android soft bus service, keep it alive, and start the discovery module, authentication module, connection module, networking module, and transmission module. Figure 6 As shown, each module provides a calling interface for the framework layer and the application layer.
[0050] 2: When the user clicks on the device discovery button, or the application needs to discover other devices, the discovery interface of the discovery module is called. The discovery interface will continue to scan the devices in the current environment that have integrated the OpenHarmony soft bus, and call back the device list to the caller (such as Figure 7 discovery module).
[0051] 3: After the user or application obtains the device list in step 2, it selects one or more devices to make a connection request. Before the connection, the connected device needs to be authenticated. The verification module receives the other device information, verifies the device through the internal algorithm, and feeds back the verification result to the caller. The devices at both ends need to ensure the same authentication strategy. (e.g. Figure 8 authentication module).
[0052] 4: After passing the device authentication in step 3, the device can be connected through the interface released by the connection module, and the connection information, status, etc. can be fed back to the connection module. The connection module uniformly manages, updates, and connects to the status to ensure the real-time nature of the connection (such as Figure 8 connection module).
[0053] 5: After multiple devices are connected, they can be networked. The interface released by the networking module provides unified device networking and topology management capabilities, and provides networked device information for data transmission (such as Figure 7 Networking module).
[0054] 6: After the devices are connected or networked, the communication module provides a data transmission channel and supports the data transmission capabilities of messages, bytes, streams, and files. Devices can call the communication module interface for stable communication (such as Figure 8 Data transmission module).
[0055] The present invention takes a unique approach on the Android platform and innovatively implements the OpenHarmony distributed soft bus technology. This technology is tailored for the Android system operating environment, allowing the Android system to seamlessly integrate the powerful functions of the OpenHarmony soft bus. This overcomes the long-standing interconnection problem between Android devices and OpenHarmony devices. From now on, different types of devices can exchange information freely and jointly build an intelligent and efficient interconnected world.
[0056] The above-mentioned embodiments are only preferred implementations of the present invention, and are only used to help understand the method and core ideas of the present application. The protection scope of the present invention is not limited to the above-mentioned embodiments. All technical solutions under the idea of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A method for implementing an OpenHarmony system soft bus on an Android platform, characterized in that: include: S1. Register the resident Android soft bus service in the Android system; S2. After the Android soft bus service is initialized, the device discovery function is started. The device discovery function integrates the coap protocol and is used for mutual discovery between Android devices and OpenHarmony devices. S3. After the device is discovered, the device authentication function is started. The device authentication function transplants the encryption and decryption library in the OpenHarmony open source warehouse to achieve authentication and intercommunication with the OpenHarmony device; S4. After device authentication, multi-device connection management is performed through the connection function; S5. Start the device networking function and achieve seamless networking among multiple devices including OpenHarmony devices by defining functions and constants for network device management. S6. Provides data transmission function, provides tcp_session management and tcp_session-based execution data receiving and sending interface to the Android system, and realizes high-speed and stable data transmission between devices.
2. The method for implementing the OpenHarmony system soft bus on the Android platform according to claim 1, characterized in that: The device discovery function described in step S2 specifically includes: setting the CoAP submodule to integrate the coap protocol and embedding it into the system in the form of a dynamic link library; providing a StartDiscovery interface, performing initialization operations through the StartDiscovery interface and calling StartDiscoveryInner for configuration; calling the ServerIpcStartDiscovery interface to prepare for inter-process communication; sending instructions through the StartDiscoveryInner interface, calling the CoapPackToPdu function to activate the CoAP submodule; after the CoAP submodule is activated, use the coap_send function to encapsulate data and send a unicast response message to complete the update of device information.
3. The method for implementing the OpenHarmony system soft bus on the Android platform according to claim 1, characterized in that: Step S3 specifically includes: creating auth_conn.c to implement the functions of sending, receiving, authenticating and obtaining keys; creating auth_interface.c to manage sessions, links, key nodes, and provide add, delete, modify and query functions; creating wifi_auth_manager.c to implement data encryption and decryption and device authentication.
4. The method for implementing the OpenHarmony system soft bus on the Android platform according to claim 1, characterized in that: The functions defined in step S5 specifically include: JoinLNN allows the device to access the local network node of a specific device; JoinMetaNode enables the device to join the specified meta node; LeaveLNN is used for the device to exit the local network node; LeaveMetaNode enables the device to exit the meta node; egNodeDeviceStateCb sets a monitor to be notified when the device status changes; PubLNN allows service information to be published on the local network node; SubLNN allows subscription to services on the local network node.
5. A device for implementing the OpenHarmony system soft bus on an Android platform, characterized in that: include: Android soft bus module: registered in the Android system as a service, registered as a resident Android soft bus service; Said Discovery module: integrates the coap protocol for mutual discovery between Android devices and OpenHarmony devices; Authentication module: transplant the encryption and decryption library in the OpenHarmony open source repository to achieve authentication and intercommunication with OpenHarmony devices; Connection module: multi-device connection management after device authentication; Networking module: By defining functions and constants for network device management, it enables seamless networking among multiple devices including OpenHarmony devices. Data transmission module: provides tcp_session management and tcp_session-based execution data receiving and sending interface to the Android system, realizing high-speed and stable data transmission between devices.
6. The device for implementing the OpenHarmony system soft bus on the Android platform according to claim 5, characterized in that: The discovery module includes: Interface submodule: Provides the StartDiscovery interface, performs initialization operations through the StartDiscovery interface and calls StartDiscoveryInner for configuration; calls the ServerIpcStartDiscovery interface of the proxy submodule to prepare for inter-process communication; Proxy submodule: provides the ServerIpcStartDiscovery interface for the interface submodule, and sends instructions to the discovery service terminal module through the StartDiscoveryInner interface; Service terminal module: after receiving the instruction, activates the CoAP submodule by calling the CoapPackToPdu function; CoAP submodule: Integrates the coap protocol and is embedded in the system in the form of a dynamic link library; after activation, it uses the coap_send function to encapsulate data and send a unicast response message to complete the update of device information.
7. The device for implementing the OpenHarmony system soft bus on the Android platform according to claim 5, characterized in that: The authentication module includes: creating auth_conn.c to provide the functions of sending, receiving, authenticating and obtaining keys; creating auth_interface.c to manage sessions, links, key nodes, and provide add, delete, modify and query functions; creating wifi_auth_manager.c to implement data encryption and decryption and device authentication.
8. The device for implementing the OpenHarmony system soft bus on the Android platform according to claim 5, characterized in that: The functions defined in the networking module include: JoinLNN allows the device to access the local network node of a specific device; JoinMetaNode enables the device to join the specified meta node; LeaveLNN is used for the device to exit the local network node; LeaveMetaNode enables the device to exit the meta node; egNodeDeviceStateCb sets a monitor to be notified when the device status changes; PubLNN allows service information to be published on the local network node; SubLNN allows subscription to services on the local network node.
9. A computer-readable storage medium storing a computer program, characterized in that: The computer program is used to execute the method for implementing the OpenHarmony system soft bus on the Android platform as described in any one of claims 1-4.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by the processor, the method for implementing the OpenHarmony system soft bus on the Android platform as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Equipment interconnection method and device based on distributed soft bus, equipment and medium
CN116962114A
Cited By
Ad hoc network communication method and device based on soft bus in power transmission line
CN119324888A
Routing terminal and generalized radio station interface definition method based on swan gap system
CN119629189A
Secure data transmission method suitable for open source gap terminal equipment
CN120750560A
A secure data transmission method suitable for open-source honeycomb terminal devices
CN120750560B
