CN117873757A - Lightweight soft bus method suitable for communication of various special-shaped physical interface devices - Google Patents
Lightweight soft bus method suitable for communication of various special-shaped physical interface devices Download PDFInfo
- Publication number
- CN117873757A CN117873757A CN202410278325.XA CN202410278325A CN117873757A CN 117873757 A CN117873757 A CN 117873757A CN 202410278325 A CN202410278325 A CN 202410278325A CN 117873757 A CN117873757 A CN 117873757A
- Authority
- CN
- China
- Prior art keywords
- bus
- business
- business process
- shared memory
- service
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 274
- 238000004891 communication Methods 0.000 title claims abstract description 40
- 230000008569 process Effects 0.000 claims abstract description 242
- 238000012545 processing Methods 0.000 claims abstract description 13
- 230000005540 biological transmission Effects 0.000 claims abstract description 12
- 230000006855 networking Effects 0.000 claims abstract description 9
- 230000006870 function Effects 0.000 claims description 32
- 238000012356 Product development Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Landscapes
- Small-Scale Networks (AREA)
Abstract
The invention discloses a lightweight soft bus method suitable for communication of various special-shaped physical interface devices, which is used for an embedded operating system and comprises the following steps: and (3) establishing a bus networking: deploying soft buses into two networks of different types, wherein processes in each device in the network can access each other on the same physical device to form a tree-shaped network; the processing of the bus comprises: registering an object, inquiring the object and authenticating the object; communication of the bus: data transmission is carried out among a plurality of processes on a plurality of special-shaped interface devices; aiming at the characteristics of the embedded product, the embedded product development efficiency can be improved, the embedded product software architecture is optimized, and the product iteration cost is reduced.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a lightweight soft bus method suitable for communication of various special-shaped physical interface devices.
Background
The buses in the computer communication system are divided into physical buses and soft buses, wherein the physical buses are channels for communication data transmission and are mainly divided into SPI buses and I2C, UART, CAN buses. The SPI and the I2C are mainly used for inter-board communication, the CAN bus is used for communication of short-distance equipment, and UART and USB support long-distance transmission.
The soft bus technology is a communication technology based on software implementation and is used for interconnection and interworking between devices. Different devices can be connected through software, and data transmission, sharing and interaction are achieved. Advantages include high flexibility, easy expansion, wide application range, etc. Through soft bus technology, devices can be connected and communicated at any time and any place without depending on hardware circuits or specific communication protocols.
The main soft buses at present are D-BUS in Linux system, ibinder in Android system and distributed soft buses of hong system, and the BUS technology of kafka and the like for big data platforms. Both ibinder and kafka are java-based implementations and are not suitable for use in embedded systems. The D-BUS in the Linux system is a IPC (interprocess communication) mechanism optimized for desktop environments, and most embedded products do not use desktop applications. DBus is divided into two types: system bus for communication and message transfer between system (Linux) and user programs; session bus (session bus) for communication between desktop (GNOME, KDE, etc.) user programs. The system bus functions are relatively simple, namely, the system bus is an advanced version of Linux IPC, and the system bus functions are also IPC. In addition, the D-BUS is realized based on socket in a Linux IPC mechanism, so that the transmission size and the transmission efficiency are limited, and the D-BUS is only suitable for transmitting control messages rather than data.
In addition, most of the existing soft buses do not basically support cross-device communication, and the cross-device communication of a hybrid interface is not supported only for one interface such as CAN, RJ45 and the like.
Disclosure of Invention
The invention aims to: the invention aims to provide a lightweight soft bus method suitable for communication of various special-shaped physical interface devices, which solves the problem of how to interact among different physical interface devices and can enable application software to realize communication without perception in a network constructed by the special-shaped interface devices.
The technical scheme is as follows: the invention relates to a method of lightweight soft bus suitable for communication of various special-shaped physical interface devices, which is used for an embedded operating system and comprises the following steps:
and (3) establishing a bus networking: deploying soft buses into two networks of different types, wherein processes in each device in the network can access each other on the same physical device to form a tree-shaped network;
the processing of the bus comprises: registering an object, inquiring the object and authenticating the object;
communication of the bus: and data transmission is carried out among a plurality of processes on a plurality of special-shaped physical interface devices.
Further, the registration of the object is specifically as follows:
(21) After the bus process is started, a local socket service is established, and the requests of other business processes are intercepted;
(22) The service process calls an API interface to initiate a registration request to the bus process through a local socket;
(23) The bus process receives a registration request of the service process through the local socket, adds a registration object into the object table, and updates the routing table at the same time;
the object table adopts a three-layer index structure, and sequentially comprises a device ID, a process ID and an object ID;
the routing table records the device ID and the process ID of each object, including: object name, device ID, process ID, interface ID; hash searching adopted by the routing table; the hash value adopts the last character of the object name character string as an index value;
further, the query of the object is a query of the object between business processes, which is specifically as follows:
let two business processes be: business process a and business process B
(31) The business process A initiates a registration request to the bus process to finish the registration of the object;
(32) The business process B calls the registered object of the business process A according to the business requirement;
(33) The business process B initiates an object calling request to the bus process;
(34) The bus process searches a routing table and an object table according to the information in the request, and finds a process A where the object is located;
(35) The bus process initiates a request to the business process A;
(36) After receiving the object calling request, the business process A executes the method function corresponding to the object;
(37) The business process A sends the information returned by the method function to the bus process;
(38) The bus process returns the return information to the business process B;
further, the authentication of the object is authentication between devices, and key authentication or device white list authentication is adopted.
Further, the bus communication adopts a mode of sharing a memory, which is specifically as follows:
let two business processes be: business process a and business process B
(51) The business process A calls a system API interface shmget to create a shared memory according to the business function requirement;
(52) The service process A registers an object to the bus process, wherein the object comprises a function interface for inquiring the shared memory id;
(53) The service process B queries a shared memory operation interface get_shm registered by the service A according to the service function;
(54) The business process A returns a shared memory ID;
(55) After the business process B acquires the shared memory ID returned by the process A, the system API interfaces shmget and shmat are called to read the data in the shared memory.
The invention relates to a lightweight soft bus system suitable for communication of various special-shaped physical interface devices, which is used for an embedded operating system and comprises:
and a bus networking building module: the soft bus is used for deploying the soft bus into two networks of different types, and processes in each device in the network can access each other on the same physical device to form a tree-shaped network;
processing module of bus: the method is used for registering bus objects, inquiring the objects and authenticating the objects;
communication module of bus: the method is used for data transmission among a plurality of processes on a plurality of special-shaped interface devices.
Further, in the processing module of the bus, the registration of the object is specifically as follows:
(21) After the bus process is started, a local socket service is established, and the requests of other business processes are intercepted;
(22) The service process calls an API interface to initiate a registration request to the bus process through a local socket;
(23) The bus process receives a registration request of the service process through the local socket, adds a registration object into the object table, and updates the routing table at the same time;
the object table adopts a three-layer index structure, and sequentially comprises a device ID, a process ID and an object ID;
the routing table records the device ID and the process ID of each object, including: object name, device ID, process ID, interface ID; hash searching adopted by the routing table; the hash value adopts the last character of the object name character string as an index value;
further, in the processing module of the bus, the query of the object is a query of the object between service processes, which specifically includes:
let two business processes be: business process a and business process B
(31) The business process A initiates a registration request to the bus process to finish the registration of the object;
(32) The business process B calls the registered object of the business process A according to the business requirement;
(33) The business process B initiates an object calling request to the bus process;
(34) The bus process searches a routing table and an object table according to the information in the request, and finds a process A where the object is located;
(35) The bus process initiates a request to the business process A;
(36) After receiving the object calling request, the business process A executes the method function corresponding to the object;
(37) The business process A sends the information returned by the method function to the bus process;
(38) The bus process returns the return information to the business process B;
further, in the processing module of the bus, the authentication of the object is authentication between devices, and key authentication or device white list authentication is adopted.
Further, in the communication module of the bus, the communication of the bus adopts a mode of sharing a memory, which is specifically as follows:
let two business processes be: business process a and business process B
(51) The business process A calls a system API interface shmget to create a shared memory according to the business function requirement;
(52) The service process A registers an object to the bus process, wherein the object comprises a function interface for inquiring the shared memory id;
(53) The service process B queries a shared memory operation interface get_shm registered by the service A according to the service function;
(54) The business process A returns a shared memory ID;
(55) After the business process B acquires the shared memory ID returned by the process A, the system API interfaces shmget and shmat are called to read the data in the shared memory.
The beneficial effects are that: compared with the prior art, the invention has the following remarkable advantages: aiming at the characteristics of the embedded product, the embedded product development efficiency can be improved, the embedded product software architecture is optimized, and the product iteration cost is reduced.
Drawings
FIG. 1 is a schematic block diagram of the present invention;
FIG. 2 is a schematic diagram of a bus networking setup of the present invention;
FIG. 3 is a schematic diagram of a networking of the special-shaped physical interfaces of the present invention;
FIG. 4 is a schematic registration diagram of an object of the present invention;
FIG. 5 is a diagram of an object query according to the present invention.
Detailed Description
The technical scheme of the invention is further described below with reference to the accompanying drawings.
As shown in fig. 1, an embodiment of the present invention provides a method for a lightweight soft bus suitable for communication of multiple special-shaped physical interface devices, for an embedded operating system, including the following steps:
as shown in fig. 2-3, establishment of bus networking: deploying soft buses into two networks of different types, wherein processes in each device in the network can access each other on the same physical device to form a tree-shaped network;
the processing of the bus comprises: registering an object, inquiring the object and authenticating the object;
as shown in fig. 4, the registration of the object is specifically as follows:
(21) After the bus process is started, a local socket service is established, and the requests of other business processes are intercepted;
(22) The service process calls an API interface to initiate a registration request to the bus process through a local socket;
(23) The bus process receives the registration request of the service process through the local socket, adds the registration object into the object table, and updates the routing table.
The object table adopts a three-layer index structure, and sequentially comprises a device ID, a process ID and an object ID;
the routing table records the device ID and the process ID of each object, including: object name, device ID, process ID, interface ID; hash searching adopted by the routing table; the hash value adopts the last character of the object name character string as an index value;
as shown in fig. 5, the query of the object is a query of the object between business processes, which is specifically as follows:
let two business processes be: business process a and business process B
(31) The business process A initiates a registration request to the bus process to finish the registration of the object;
(32) The business process B calls the registered object of the business process A according to the business requirement;
(33) The business process B initiates an object calling request to the bus process;
(34) The bus process searches a routing table and an object table according to the information in the request, and finds a process A where the object is located;
(35) The bus process initiates a request to the business process A;
(36) After receiving the object calling request, the business process A executes the method function corresponding to the object;
(37) The business process A sends the information returned by the method function to the bus process;
(38) The bus process returns the return information to the business process B;
the authentication of the object is authentication between devices, and key authentication or device white list authentication is adopted.
Communication of the bus: and data transmission is carried out among a plurality of processes on a plurality of special-shaped interface devices.
The bus communication adopts a mode of sharing a memory, and is concretely as follows:
let two business processes be: business process a and business process B
(51) The business process A calls a system API interface shmget to create a shared memory according to the business function requirement;
(52) The service process A registers an object to the bus process, wherein the object comprises a function interface for inquiring the shared memory id;
(53) The service process B queries a shared memory operation interface get_shm registered by the service A according to the service function;
(54) The business process A returns a shared memory ID;
(55) After the business process B acquires the shared memory ID returned by the process A, the system API interfaces shmget and shmat are called to read the data in the shared memory.
The embodiment of the invention also provides a system of a lightweight soft bus suitable for communication of various special-shaped physical interface devices, which is used for an embedded operating system and comprises:
and a bus networking building module: the soft bus is used for deploying the soft bus into two networks of different types, and processes in each device in the network can access each other on the same physical device to form a tree-shaped network;
processing module of bus: the method is used for registering bus objects, inquiring the objects and authenticating the objects;
the registration of the object is specifically as follows:
(21) After the bus process is started, a local socket service is established, and the requests of other business processes are intercepted;
(22) The service process calls an API interface to initiate a registration request to the bus process through a local socket;
(23) The bus process receives the registration request of the service process through the local socket, adds the registration object into the object table, and updates the routing table.
The object table adopts a three-layer index structure, and sequentially comprises a device ID, a process ID and an object ID;
the routing table records the device ID and the process ID of each object, including: object name, device ID, process ID, interface ID; hash searching adopted by the routing table; the hash value adopts the last character of the object name character string as an index value;
the query of the object is the query of the object between business processes, and is specifically as follows:
let two business processes be: business process a and business process B
(31) The business process A initiates a registration request to the bus process to finish the registration of the object;
(32) The business process B calls the registered object of the business process A according to the business requirement;
(33) The business process B initiates an object calling request to the bus process;
(34) The bus process searches a routing table and an object table according to the information in the request, and finds a process A where the object is located;
(35) The bus process initiates a request to the business process A;
(36) After receiving the object calling request, the business process A executes the method function corresponding to the object;
(37) The business process A sends the information returned by the method function to the bus process;
(38) The bus process returns the return information to the business process B;
the authentication of the object is authentication between devices, and key authentication or device white list authentication is adopted.
Communication module of bus: the method is used for data transmission among a plurality of processes on a plurality of special-shaped interface devices.
The bus communication adopts a mode of sharing a memory, and is concretely as follows:
let two business processes be: business process a and business process B
(51) The business process A calls a system API interface shmget to create a shared memory according to the business function requirement;
(52) The service process A registers an object to the bus process, wherein the object comprises a function interface for inquiring the shared memory id;
(53) The service process B queries a shared memory operation interface get_shm registered by the service A according to the service function;
(54) The business process A returns a shared memory ID;
(55) After the business process B acquires the shared memory ID returned by the process A, the system API interfaces shmget and shmat are called to read the data in the shared memory.
Claims (10)
1. A method of lightweight soft bus for communication of multiple profiled physical interface devices for an embedded operating system, comprising the steps of:
and (3) establishing a bus networking: deploying soft buses into two networks of different types, wherein processes in each device in the network can access each other on the same physical device to form a tree-shaped network;
the processing of the bus comprises: registering an object, inquiring the object and authenticating the object;
communication of the bus: and data transmission is carried out among a plurality of processes on a plurality of special-shaped interface devices.
2. A method of lightweight soft bus for communication of a plurality of shaped physical interface devices according to claim 1, characterized in that the registration of the objects is specifically as follows:
(21) After the bus process is started, a local socket service is established, and the requests of other business processes are intercepted;
(22) The service process calls an API interface to initiate a registration request to the bus process through a local socket;
(23) The bus process receives a registration request of the service process through the local socket, adds a registration object into the object table, and updates the routing table at the same time;
the object table adopts a three-layer index structure, and sequentially comprises a device ID, a process ID and an object ID;
the routing table records the device ID and the process ID of each object, including: object name, device ID, process ID, interface ID; hash searching adopted by the routing table; wherein the hash value uses the last character of the object name string as an index value.
3. The method of claim 1, wherein the query of the object is a query of an object between business processes, and the method is specifically as follows:
let two business processes be: business process a and business process B
(31) The business process A initiates a registration request to the bus process to finish the registration of the object;
(32) The business process B calls the registered object of the business process A according to the business requirement;
(33) The business process B initiates an object calling request to the bus process;
(34) The bus process searches a routing table and an object table according to the information in the request, and finds a process A where the object is located;
(35) The bus process initiates a request to the business process A;
(36) After receiving the object calling request, the business process A executes the method function corresponding to the object;
(37) The business process A sends the information returned by the method function to the bus process;
(38) The bus process returns the return information to business process B.
4. A method of lightweight soft bus for communication of multiple shaped physical interface devices as defined in claim 1, wherein the authentication of the object is an inter-device authentication, using key authentication or device whitelist authentication.
5. The method of claim 1, wherein the bus communication is performed by using a shared memory, and the method is as follows:
let two business processes be: business process a and business process B
(51) The business process A calls a system API interface shmget to create a shared memory according to the business function requirement;
(52) The service process A registers an object to the bus process, wherein the object comprises a function interface for inquiring the shared memory id;
(53) The service process B queries a shared memory operation interface get_shm registered by the service A according to the service function;
(54) The business process A returns a shared memory ID;
(55) After the business process B acquires the shared memory ID returned by the process A, the system API interfaces shmget and shmat are called to read the data in the shared memory.
6. A system for a lightweight soft bus for communication of a plurality of profiled physical interface devices, comprising:
and a bus networking building module: the soft bus is used for deploying the soft bus into two networks of different types, and processes in each device in the network can access each other on the same physical device to form a tree-shaped network;
processing module of bus: the method is used for registering bus objects, inquiring the objects and authenticating the objects;
communication module of bus: the method is used for data transmission among a plurality of processes on a plurality of special-shaped interface devices.
7. A system for a lightweight soft bus for communication of multiple shaped physical interface devices as defined in claim 6 wherein the registration of objects in the processing module of the bus is specifically as follows:
(21) After the bus process is started, a local socket service is established, and the requests of other business processes are intercepted;
(22) The service process calls an API interface to initiate a registration request to the bus process through a local socket;
(23) The bus process receives a registration request of the service process through the local socket, adds a registration object into the object table, and updates the routing table at the same time;
the object table adopts a three-layer index structure, and sequentially comprises a device ID, a process ID and an object ID;
the routing table records the device ID and the process ID of each object, including: object name, device ID, process ID, interface ID; hash searching adopted by the routing table; wherein the hash value uses the last character of the object name string as an index value.
8. The system of claim 6, wherein the query of the object in the processing module of the bus is a query of an object between business processes, and the system is characterized in that:
let two business processes be: business process a and business process B
(31) The business process A initiates a registration request to the bus process to finish the registration of the object;
(32) The business process B calls the registered object of the business process A according to the business requirement;
(33) The business process B initiates an object calling request to the bus process;
(34) The bus process searches a routing table and an object table according to the information in the request, and finds a process A where the object is located;
(35) The bus process initiates a request to the business process A;
(36) After receiving the object calling request, the business process A executes the method function corresponding to the object;
(37) The business process A sends the information returned by the method function to the bus process;
(38) The bus process returns the return information to business process B.
9. The system of claim 6, wherein the authentication of the object in the processing module of the bus is an inter-device authentication, and key authentication or device whitelist authentication is used.
10. The system of claim 6, wherein the communication module of the bus is a shared memory, and the system is characterized in that:
let two business processes be: business process a and business process B
(51) The business process A calls a system API interface shmget to create a shared memory according to the business function requirement;
(52) The service process A registers an object to the bus process, wherein the object comprises a function interface for inquiring the shared memory id;
(53) The service process B queries a shared memory operation interface get_shm registered by the service A according to the service function;
(54) The business process A returns a shared memory ID;
(55) After the business process B acquires the shared memory ID returned by the process A, the system API interfaces shmget and shmat are called to read the data in the shared memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410278325.XA CN117873757B (en) | 2024-03-12 | Lightweight soft bus method suitable for communication of various special-shaped physical interface devices |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410278325.XA CN117873757B (en) | 2024-03-12 | Lightweight soft bus method suitable for communication of various special-shaped physical interface devices |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117873757A true CN117873757A (en) | 2024-04-12 |
CN117873757B CN117873757B (en) | 2024-06-04 |
Family
ID=
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105335221A (en) * | 2015-10-09 | 2016-02-17 | 中国电子科技集团公司第二十九研究所 | Reconstructible distributed software bus |
CN115767499A (en) * | 2022-11-14 | 2023-03-07 | 深圳开鸿数字产业发展有限公司 | Equipment interconnection method, device, equipment and medium based on distributed soft bus |
WO2023093039A1 (en) * | 2021-11-25 | 2023-06-01 | 北京字节跳动网络技术有限公司 | Inter-process communication method and system |
CN116962114A (en) * | 2023-06-19 | 2023-10-27 | 鸿湖万联(江苏)科技发展有限公司 | Equipment interconnection method, device, equipment and medium based on distributed soft bus |
CN117527479A (en) * | 2024-01-08 | 2024-02-06 | 深圳易思智科技有限公司 | Soft bus networking connection method, device, equipment and storage medium |
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105335221A (en) * | 2015-10-09 | 2016-02-17 | 中国电子科技集团公司第二十九研究所 | Reconstructible distributed software bus |
WO2023093039A1 (en) * | 2021-11-25 | 2023-06-01 | 北京字节跳动网络技术有限公司 | Inter-process communication method and system |
CN115767499A (en) * | 2022-11-14 | 2023-03-07 | 深圳开鸿数字产业发展有限公司 | Equipment interconnection method, device, equipment and medium based on distributed soft bus |
CN116962114A (en) * | 2023-06-19 | 2023-10-27 | 鸿湖万联(江苏)科技发展有限公司 | Equipment interconnection method, device, equipment and medium based on distributed soft bus |
CN117527479A (en) * | 2024-01-08 | 2024-02-06 | 深圳易思智科技有限公司 | Soft bus networking connection method, device, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
吕广等: "面向嵌入式领域的分布式软总线设计与实现", 《无线互联科技》, 30 November 2023 (2023-11-30) * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8347008B2 (en) | Method and system for hardware based implementation of USB 1.1 over a high speed link | |
US6999997B2 (en) | Method and apparatus for communication of message data using shared queues | |
US9549025B2 (en) | Protocol optimization for client and server synchronization | |
WO2015127722A1 (en) | Method and system for synchronizing contact persons based on cloud platform | |
CN108737527B (en) | Large-scale user access method and system suitable for platform | |
WO2023202451A1 (en) | Task processing method and apparatus, device, and medium | |
CN101739295A (en) | Method and device for calling extension program based on process | |
CN117873757B (en) | Lightweight soft bus method suitable for communication of various special-shaped physical interface devices | |
US6839732B1 (en) | Efficient use of domain socket pairs in communication for tightly coupled transactions | |
CN117873757A (en) | Lightweight soft bus method suitable for communication of various special-shaped physical interface devices | |
WO2021051569A1 (en) | Data isolation method and apparatus, computer device and storage medium | |
CN115277707A (en) | Service processing method, device, electronic equipment and storage medium | |
CN107766164A (en) | Data calling method and device | |
CN112559472B (en) | File transmission method, device, computer equipment and storage medium | |
CN114860228A (en) | Module centralization sharing system realized based on Module Federation technology | |
CN110661857B (en) | Data synchronization method and device | |
CN113596085A (en) | Data processing method, system and device | |
CN112965925B (en) | Communication method, communication device, master equipment and slave equipment | |
KR102491998B1 (en) | Virtualization server, operating method of server virtualization system, and program using the same | |
JP3176199B2 (en) | Server client system | |
CN1017285B (en) | Peripheral bus | |
CN117762880A (en) | Data access method and computing device | |
GB2217562A (en) | Requesting service from a host | |
Moiz et al. | Replication strategies in mobile environments | |
CN116756214A (en) | Data processing method, device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |