





技术领域technical field
本发明涉及一种实现板间对象通信的方法,特别一种适用于嵌入式系统的板间通信的方法。The invention relates to a method for realizing inter-board object communication, in particular to a method for inter-board communication suitable for embedded systems.
背景技术Background technique
目前UML(Unified Modeling Language)在嵌入式系统的设计开发中已经有不少应用。使用UML设计工具可以在OMD(Object Model Diagram)图中建立各个对象的联系,然后对象之间就可以通过这个联系发消息进行通信。有些UML设计工具还可以提供动画功能,将对象间的交互在顺序图中表现出来,非常直观。At present, UML (Unified Modeling Language) has been widely used in the design and development of embedded systems. UML design tools can be used to establish the connection of each object in the OMD (Object Model Diagram) diagram, and then the objects can communicate through this connection by sending messages. Some UML design tools can also provide animation functions to show the interaction between objects in the sequence diagram, which is very intuitive.
因为对象间的通信实际上是通过对象指针来完成的,所以这种通信方式只能在同一个进程或板上实现,不同板之间的通信不能采用这种方法。Because the communication between objects is actually completed through object pointers, this communication method can only be realized in the same process or board, and this method cannot be used for communication between different boards.
在对板间通信的专利检索中,没有找到类似的专利解决这个不便。In the patent search for inter-board communication, no similar patents were found to solve this inconvenience.
根据目前所知,板间通信一般都是通过一些固定的原语调用来完成的。这种方法使板内和板间的对象通信方法不一样,开发人员需要在编码中用两套通信流程,增加了复杂性;同时,用这类通信方法,也就无法用到UML设计工具的动画功能,如某些设计工具提供的顺序图显示功能来协助设计。According to what is known so far, inter-board communication is generally accomplished through some fixed primitive calls. This method makes the object communication method between the board and the board different, and the developer needs to use two sets of communication processes in the coding, which increases the complexity; at the same time, with this communication method, the UML design tool cannot be used. Animation functions, such as the sequence diagram display function provided by some design tools to assist in design.
发明内容Contents of the invention
本发明的目的是提供一种实现板间对象通信的方法,特别一种适用于嵌入式系统的板间通信的方法。可屏蔽板内对象和板间对象的差别,使板间通信对上层应用程序完全透明,同时能使用UML设计工具提供的动画等功能。The object of the present invention is to provide a method for realizing inter-board object communication, especially a method for inter-board communication suitable for embedded systems. It can shield the difference between intra-board objects and inter-board objects, so that inter-board communication is completely transparent to the upper application program, and at the same time, functions such as animation provided by UML design tools can be used.
本发明是这样实现的:一种实现板间对象通信的方法,其特征在于至少包括以下步骤:The present invention is achieved in that a method for realizing inter-board object communication is characterized in that it includes at least the following steps:
对其他板上所有需要和本板通信的静态对象都在本板的程序中创建一个映射的对象,称之为skeleton对象(skeleton对象的概念和作用与OMG CORBA标准中的skeleton相似),作为通信的中介,和其他板上需要与本板通信的静态对象一一对应;For all the static objects on other boards that need to communicate with this board, create a mapped object in the program of this board, called the skeleton object (the concept and function of the skeleton object are similar to the skeleton in the OMG CORBA standard), as a communication The intermediary, and the static objects on other boards that need to communicate with this board;
由本板的静态对象将消息发给其他板上对应的静态对象在本板上的skeleton对象;The static object on this board sends the message to the corresponding static object on other boards on the skeleton object on this board;
在本板上创建的其他板上对应的静态对象的skeleton对象截取消息,处理成统一的数据格式发送给本板的板间通信模块;The skeleton object of the corresponding static object on other boards created on this board intercepts the message, processes it into a unified data format and sends it to the inter-board communication module of this board;
板间通信模块将消息发送到其他板;The inter-board communication module sends messages to other boards;
其他板的板间通信模块从通信线路上收到消息时,判断发送消息的静态对象对应的skeleton对象是否存在,如果不存在,则动态创建发送消息的静态对象对应的skeleton对象;When the inter-board communication module of other boards receives a message from the communication line, it judges whether the skeleton object corresponding to the static object sending the message exists, and if it does not exist, dynamically creates the skeleton object corresponding to the static object sending the message;
其他板的板间通信模块生成消息,发送给其他板上的静态对象。Inter-board communication modules of other boards generate messages, which are sent to static objects on other boards.
一种从板A上的静态对象C发消息给板B上的静态的目的对象,实现板间对象通信的方法,其特征在于包括以下步骤:A method for sending a message from a static object C on a board A to a static destination object on a board B to realize inter-board object communication, characterized in that it comprises the following steps:
板A上的板间通信模块启动时建立一些skeleton对象,和板B上的需要与本板通信的静态的目的对象一一对应,这样在板A中,就有了静态的目的对象的skeleton对象;When the inter-board communication module on board A starts, it creates some skeleton objects, which correspond to the static destination objects on board B that need to communicate with this board, so that in board A, there are skeleton objects of static destination objects. ;
静态对象C将消息发给静态的目的对象在板A上的skeleton对象;The static object C sends the message to the skeleton object of the static destination object on board A;
板A上静态的目的对象的skeleton对象截取消息,处理成统一的数据格式发送给板A的板间通信模块;The skeleton object of the static destination object on board A intercepts the message, processes it into a unified data format and sends it to the inter-board communication module of board A;
板间通信模块将数据发送到板B;The inter-board communication module sends data to board B;
板B的板间通信模块从通信线路上收到信息时,判断发送消息的静态对象C对应的skeleton对象是否存在,如果不存在,则动态创建静态对象C对应的skeleton对象;When the inter-board communication module of board B receives information from the communication line, it judges whether the skeleton object corresponding to the static object C that sends the message exists, and if it does not exist, dynamically creates the skeleton object corresponding to the static object C;
板B的板间通信模块生成消息,发送给静态的目的对象。The inter-board communication module of board B generates a message and sends it to the static destination object.
所述每一个和其他板通信的静态对象在析构时,该静态对象要向板间通信模块注销,板间通信模块将注销消息发送到其他板上,让其他板删除该静态对象对应的skeleton对象;When each static object communicating with other boards is destroyed, the static object should be logged out to the inter-board communication module, and the inter-board communication module will send a logout message to other boards to let other boards delete the skeleton corresponding to the static object object;
如果通信链路中断,则板间通信模块删除所有动态创建的skeleton对象;If the communication link is interrupted, the inter-board communication module deletes all dynamically created skeleton objects;
本发明和其他板间通信的方法相比优点主要有:Compared with other inter-board communication methods, the present invention has the following advantages:
对应用程序设计来说,无论对象在什么地方,通信的方法都是一样的,真正实现了完全透明;For application programming, no matter where the object is, the method of communication is the same, and it is completely transparent;
UML设计工具的动画功能可以使用,对调试很有帮助。The animation function of the UML design tool can be used, which is very helpful for debugging.
附图说明Description of drawings
图1是本发明的原理图。Figure 1 is a schematic diagram of the present invention.
图2是板间通信模块的启动流程图。Fig. 2 is the start-up flowchart of the inter-board communication module.
图3是板间通信模块的通信流程图。Fig. 3 is a communication flowchart of the inter-board communication module.
图4是需要通信的对象被删除的流程图。Fig. 4 is a flow chart of deleting an object requiring communication.
图5是通信中断的处理流程图。Fig. 5 is a flow chart of the processing of communication interruption.
图6是本发明的方法构建的一个板间通信模块实例图。Fig. 6 is an example diagram of an inter-board communication module constructed by the method of the present invention.
图1是本发明的原理图,表示一次单向通信的原理。数据从对象C发出,依次经过目的对象的skeleton对象,板A的板间通信模块,板B的板间通信模块,然后到达目的对象。如果目的对象要发消息给对象C,则需要在板B中建立对象C的skeleton对象,并进行相反的过程。Fig. 1 is a schematic diagram of the present invention, showing the principle of a one-way communication. The data is sent from object C, passes through the skeleton object of the destination object, the inter-board communication module of board A, and the inter-board communication module of board B, and then reaches the destination object. If the destination object wants to send a message to object C, it needs to create the skeleton object of object C in board B, and perform the reverse process.
图2说明了板A的板间通信模块的启动流程,板间通信模块在启动时要创建其他板上要和本板通信的对象的skeleton对象。Figure 2 illustrates the startup process of the inter-board communication module of board A. When the inter-board communication module starts, it needs to create skeleton objects of objects on other boards that want to communicate with this board.
图3说明了从板A的对象C发消息给板B的目的对象的流程,是对图1的流程形式表示。FIG. 3 illustrates the flow of sending a message from object C of board A to the destination object of board B, which is a representation of the flow in FIG. 1 .
图4说明了对象析构时需要进行的工作流程。由于对象析构时其他板并不知道,所以需要板间通信模块将对象的析构消息通知其他板,使其他板的板间通信模块有机会删除其对应的skeleton对象。Figure 4 illustrates the workflow required for object destruction. Since other boards do not know when the object is destroyed, it is necessary for the inter-board communication module to notify other boards of the object's destruction message, so that the inter-board communication modules of other boards have the opportunity to delete their corresponding skeleton objects.
图5表示了通信中断时的处理流程。通信中断时要删除所有动态创建的skeleton对象,因为如果这些skeleton对象对应的真实对象析构,在通信中断的时候是无法通知本板的,就会造成这些skeleton对象永远无法删除。Fig. 5 shows the processing flow when the communication is interrupted. When the communication is interrupted, all dynamically created skeleton objects should be deleted, because if the real objects corresponding to these skeleton objects are destroyed, the board cannot be notified when the communication is interrupted, and these skeleton objects will never be deleted.
图6是本发明的方法构建的一个板间通信模块及skeleton对象的图。图中,应用模块的对象将板间通信的消息发送给skeleton对象,然后再发给stub对象转发给通信对象,最后发送到通信链路上传给对方;接收则是完全相反的过程。Fig. 6 is a diagram of an inter-board communication module and a skeleton object constructed by the method of the present invention. In the figure, the object of the application module sends the inter-board communication message to the skeleton object, then sends it to the stub object, forwards it to the communication object, and finally sends it to the communication link to upload to the other party; receiving is the complete opposite process.
具体实施方式Detailed ways
用本发明的方法,构造了一个板间通信模块,详述如下:With the method of the present invention, an inter-board communication module is constructed, which is described in detail as follows:
这个实施例是用I-Logix公司的UML设计工具Rhapsody开发的。在程序设计中,skeleton对象可能和各种对象建立联系,所以各个skeleton对象的数据结构都不相同,不能用一个对象类来表示。同时由于skeleton对象收到的消息种类无法预料,造成skeleton对象不能在Rhapsody中用状态图表达其逻辑。对于这些问题,实施中对Rhapsody的底层库OXF(Object executableFramework)进行修改,截取skeleton对象的消息处理,然后进行转发。This embodiment is developed with UML design tool Rhapsody of I-Logix Company. In programming, a skeleton object may be associated with various objects, so the data structure of each skeleton object is different and cannot be represented by an object class. At the same time, because the types of messages received by the skeleton object are unpredictable, the skeleton object cannot use the state diagram to express its logic in Rhapsody. For these problems, the underlying library OXF (Object executable Framework) of Rhapsody is modified in the implementation, and the message processing of the skeleton object is intercepted, and then forwarded.
因为动态创建的对象进行板间通信会带来很多问题,所以此实现中只考虑静态创建的对象间的通信。这些对象在程序运行开始时就创建好,生存期和程序的生存期相同。如果是对象只有一个实例,则一开始就可以建好其对应的skeleton对象;如果是多实例对象,就动态创建其skeleton对象。Because the inter-board communication of dynamically created objects will bring many problems, only the communication between statically created objects is considered in this implementation. These objects are created at the beginning of program execution and have the same lifetime as the program. If the object has only one instance, its corresponding skeleton object can be built at the beginning; if it is a multi-instance object, its skeleton object can be created dynamically.
对于每一块和本板通信的板,都对应唯一的stub对象,它接收skeleton对象转发来的消息数据,保存在自己的缓冲区中,并将其拆成小数据帧,发送给Socket或RS232等通信对象,由它们进行发送。如果由数据被通信对象收到,也传给stub对象,由它组合成消息帧,转发给接收的对象。For each board that communicates with this board, it corresponds to a unique stub object, which receives the message data forwarded by the skeleton object, saves it in its own buffer, and splits it into small data frames, and sends them to Socket or RS232, etc. Communication objects, by which they send. If the data is received by the communication object, it is also passed to the stub object, which is combined into a message frame and forwarded to the receiving object.
静态的skeleton对象由应用程序自己建立,由于OXF已经被修改,skeleton对象在注册时会将消息分发函数交给板间通信模块接管,新的分发函数不处理Framework Event以及所有ID<0的系统消息,如timeout,startbehavior等。The static skeleton object is created by the application itself. Since OXF has been modified, the skeleton object will hand over the message distribution function to the inter-board communication module to take over when registering. The new distribution function does not process Framework Event and all system messages with ID<0 , such as timeout, startbehavior, etc.
新的消息分发函数处理两类消息:The new message dispatch function handles two types of messages:
a)普通的消息。对于这些消息,分发函数根据消息长度组合成数据消息(名称可取为EV_DATA)发给stub对象,a) Ordinary news. For these messages, the distribution function composes a data message (the name may be EV_DATA) according to the length of the message and sends it to the stub object.
b)变长数据消息。板间通信中有时需要发送变长数据,一般发送变长数据的做法是在消息的数据结构中加上指针进行传送,而指针在其他板上是无效的。为此,专门定义了变长数据消息EV_VARIANT,应用程序可以发送此消息给skeleton对象,分发函数组合成EV_DATA消息发给stub对象。b) Variable length data messages. Sometimes it is necessary to send variable-length data in inter-board communication. Generally, the method of sending variable-length data is to add a pointer to the data structure of the message for transmission, and the pointer is invalid on other boards. For this purpose, a variable-length data message EV_VARIANT is specially defined, and the application program can send this message to the skeleton object, and the distribution function is combined into an EV_DATA message and sent to the stub object.
stub对象拥有一个大缓冲区,保存skeleton对象发来的消息,然后逐渐地把缓冲区中的信息分割成小数据帧,加上发给通信对象,完成发送。如果缓冲区满,则消息丢弃。在接收到数据帧时,stub对象将其组合成消息,然后发送给skeleton对象。Stub对象存在的意义就在于它能屏蔽底层的通信方法,无论是采用Socket还是RS232,Stub对象的操作是一样的。The stub object has a large buffer to save the message sent by the skeleton object, and then gradually divides the information in the buffer into small data frames, and sends them to the communication object to complete the sending. If the buffer is full, the message is discarded. When a data frame is received, the stub object assembles it into a message and sends it to the skeleton object. The significance of the existence of the Stub object is that it can shield the underlying communication method, whether using Socket or RS232, the operation of the Stub object is the same.
通信对象完成真正的通信工作,如socket的收发等。在通信对象的发送缓冲区空时,发消息通知stub对象,以允许stub对象发送新的数据包。The communication object completes the real communication work, such as socket sending and receiving. When the sending buffer of the communication object is empty, send a message to notify the stub object to allow the stub object to send a new data packet.
要实现消息的透明转发,分发函数必须知道消息的长度,这只能在消息创建时知道,所以需要在Rhapsody的代码生成配置中修改消息的内存分配过程,在完成内存分配后将消息长度填入结构成员中。To achieve transparent forwarding of messages, the distribution function must know the length of the message, which can only be known when the message is created, so it is necessary to modify the memory allocation process of the message in Rhapsody's code generation configuration, and fill in the message length after the memory allocation is completed. member of the structure.
为了实现动画,Rhapsody对每一种消息都有对应的ARCEventClass对象,在收到板间通信消息时必须创建ARCEvent,但由于此时仅仅知道消息ID,不知道其对应的ARCEventClass对象,无法创建。这可以这样解决:In order to realize animation, Rhapsody has a corresponding ARCEventClass object for each message, and must create an ARCEvent when receiving an inter-board communication message, but since it only knows the message ID at this time, it does not know its corresponding ARCEventClass object, so it cannot be created. This can be solved like this:
a)修改Rhapsody的代码生成配置中修改消息的内存分配过程,此时可以记录消息的名称。a) Modify the memory allocation process of the message in the code generation configuration of Rhapsody. At this time, the name of the message can be recorded.
b)在编译选项有Rhaspody动画代码时,包的初始化过程会初始化ARCEventClass,由于它用的是宏,可以修改宏定义,在初始化ARCEventClass后将消息名称和ARCEventClass对象的指针加入一张映射表。b) When the compilation option has Rhaspody animation code, the initialization process of the package will initialize ARCEventClass. Since it uses a macro, you can modify the macro definition. After initializing ARCEventClass, add the message name and the pointer of the ARCEventClass object to a mapping table.
c)在有板间消息数据传来时,根据消息名称查找其对应的ARCEventClass对象,实现消息的发送。c) When there is an inter-board message data, search for the corresponding ARCEventClass object according to the message name to realize the sending of the message.
本发明方法独特,使板间通信对用UML设计的应用程序完全透明,并且使板间对象的交互可以用动画功能进行调试,加快了开发进度,减少了发生错误的可能。The method of the invention is unique, which makes the inter-board communication completely transparent to the application program designed with UML, and enables the inter-board object interaction to be debugged by animation function, thereby speeding up the development progress and reducing the possibility of errors.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB021366500ACN100426808C (en) | 2002-08-21 | 2002-08-21 | Method for implementing interplate object communication |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB021366500ACN100426808C (en) | 2002-08-21 | 2002-08-21 | Method for implementing interplate object communication |
| Publication Number | Publication Date |
|---|---|
| CN1477839A CN1477839A (en) | 2004-02-25 |
| CN100426808Ctrue CN100426808C (en) | 2008-10-15 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB021366500AExpired - Fee RelatedCN100426808C (en) | 2002-08-21 | 2002-08-21 | Method for implementing interplate object communication |
| Country | Link |
|---|---|
| CN (1) | CN100426808C (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN100382502C (en)* | 2005-06-01 | 2008-04-16 | 华为技术有限公司 | A system for single-board debugging serial port mapping |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1298508A (en)* | 1998-02-26 | 2001-06-06 | 太阳微系统公司 | A downloadable intelligent agent that performs processing related to remote procedure calls in a distributed system |
| CN1330834A (en)* | 1998-11-05 | 2002-01-09 | Bea系统公司 | Smart Stubs or Enterprise JAVATM Bean Modules in Distributed Processing Systems |
| US20020023173A1 (en)* | 1998-11-05 | 2002-02-21 | Bea Systems, Inc. | Duplicated naming service in a distributed processing system |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1298508A (en)* | 1998-02-26 | 2001-06-06 | 太阳微系统公司 | A downloadable intelligent agent that performs processing related to remote procedure calls in a distributed system |
| CN1330834A (en)* | 1998-11-05 | 2002-01-09 | Bea系统公司 | Smart Stubs or Enterprise JAVATM Bean Modules in Distributed Processing Systems |
| US20020023173A1 (en)* | 1998-11-05 | 2002-02-21 | Bea Systems, Inc. | Duplicated naming service in a distributed processing system |
| Title |
|---|
| 用Java RMI实现网络远程测试. 陈宝莲.电子科技大学硕士学位论文. 2001* |
| Publication number | Publication date |
|---|---|
| CN1477839A (en) | 2004-02-25 |
| Publication | Publication Date | Title |
|---|---|---|
| US20020069400A1 (en) | System for reusable software parts for supporting dynamic structures of parts and methods of use | |
| CN107168746B (en) | Method and device for generating microservices | |
| CN108897538A (en) | Page view display method and device, storage medium and electronic terminal | |
| US20020161907A1 (en) | Adaptive multi-protocol communications system | |
| CN110287040B (en) | Implementation system for remotely calling service framework | |
| CN108958708A (en) | A kind of software system architecture component-based and software implementation method | |
| CN101876906A (en) | A method and device for running an Android system using a Linux application | |
| Campbell et al. | A technique for documenting the framework of an object-oriented system | |
| CN108008950A (en) | The implementation method and device of a kind of user interface updating | |
| CN102929681A (en) | Frame code automatic generating method of virtual test distributed type object model | |
| CN110058900B (en) | Data transmission service system based on pluggable component framework | |
| CN111782194B (en) | Automatic generation method of portable unit code based on aviation embedded open system architecture | |
| CN100426808C (en) | Method for implementing interplate object communication | |
| CN111736844B (en) | Database cloud service standard interface and implementation method | |
| CN117971760A (en) | Edge computing device framework systems, chips, storage media, and apparatus | |
| CN109582318B (en) | Portobuf localization processing method, device, terminal and storage medium | |
| CN106330519B (en) | A method and system for communicating messages between network management systems | |
| CN110502418B (en) | Method for realizing remote debugging | |
| CN113778388A (en) | Program development method and apparatus | |
| CN102420849A (en) | Mobile main body platform model and mobile main body migration method | |
| CN105404557A (en) | Interprocess communication method based on message queue | |
| CN107291455B (en) | Method and system for realizing transfer service based on factory mode | |
| JPH11238004A (en) | System simulator | |
| CN100478899C (en) | Object transmitting method, device and system | |
| CN101577763B (en) | Cellphone message tracking mechanism and cellphone code test method |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20081015 Termination date:20140821 | |
| EXPY | Termination of patent right or utility model |