WO2009046593A1 - Application communication method for terminal - Google Patents

Application communication method for terminal Download PDF

Info

Publication number
WO2009046593A1
WO2009046593A1 PCT/CN2007/003763 CN2007003763W WO2009046593A1 WO 2009046593 A1 WO2009046593 A1 WO 2009046593A1 CN 2007003763 W CN2007003763 W CN 2007003763W WO 2009046593 A1 WO2009046593 A1 WO 2009046593A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
application
channel
communication
processing module
Prior art date
Application number
PCT/CN2007/003763
Other languages
French (fr)
Chinese (zh)
Inventor
Zemin Wang
Xin Yang
Fei Ju
Youpeng Gu
Original Assignee
Zte Corporation
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zte Corporation filed Critical Zte Corporation
Publication of WO2009046593A1 publication Critical patent/WO2009046593A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements

Definitions

  • the present invention relates to the field of terminal software, and in particular, to a method for application communication of a terminal.
  • the mobile terminal device is an embedded software device. At the same time, it is different from the universal embedded device. It has good human-computer interaction, and satisfies the individual requirements of the functions, styles and usage habits of the human terminal; With the rapid development and use of mobile terminals, a mobile terminal is required to perform as many tasks as possible to facilitate people's work and life. Therefore, the mobile terminal device inevitably has multiple tasks and multiple processes in the internal embedded software implementation, and the efficiency of application communication between these multi-tasking and multi-process determines the performance of the mobile terminal to a large extent. Therefore, the clean and efficient application communication in the mobile terminal is a key issue in the development of mobile terminal software.
  • Application communication provides basic communication capabilities for communication between different applications, whether the application of these communications is within the same thread (or process) or between different threads (or processes).
  • the most basic form of application communication is the IPC (InterProcess Communications Protocol) provided by the operating system.
  • IPC InterProcess Communications Protocol
  • the IPC format provided by the operating system is too primitive and too simple. It is generally suitable only for writing lower-level software systems.
  • the QCop communication mechanism adopts the publish/subscrible mode, which makes the communication very scalable; it is used for communication between different clients within the same address space or between different processes.
  • the originator of the message only needs to create a QCopEnvelope object containing the channel name, Message name, parameters, etc.; the recipient of the message must first create a message in order to receive the message.
  • the QCopChannel object the channel that wants to receive the message, indicates the correspondence with the sender of the message; at the same time, relying on its internal function callback mechanism-signal-slot mechanism, the QCop communication mechanism solves the received message and The processing relationship for receiving messages. Therefore, for the Qcop communication mechanism, the communication participant only needs to know the message channel name of Qcop, and any sender can send any message to any receiver, which makes the communication have good flexibility and scalability.
  • QCop communication mechanism is aimed at high-end smart phones, so it is not very suitable for low-end and mid-range mobile phones in terms of structural complexity and operation mechanism; at the same time, its object-oriented design ideas are transplanted to face There are certain difficulties in the design of the process, and the internal signal-slot mechanism introduces a high degree of internal coupling.
  • the biggest drawback of the QCop communication mechanism is that it does not support synchronous transmission of messages, which brings developers. Additional development difficulty.
  • D-Bus application communication is a message bus system that provides a simple way to communicate between applications.
  • the message bus is built on a common one-to-one message transmission framework.
  • D-BUS provides a daemon (also known as a message bus daemon) that routes messages on a particular bus, thus forming a bus topology that allows processes to be at the same time.
  • daemon also known as a message bus daemon
  • applications can send or listen to various events on the bus. It can be seen that compared with the QCop communication mechanism, although D-BUS supports the synchronous transmission of messages, its implementation mechanism is extremely complicated, and it is necessary to specifically start a background message bus server in the system, so it is more suitable for the application of high-end smartphone framework. Communication between.
  • QCop communication protocol and D-Bus application communication are huge in structure for medium and low-end mobile phones, and require a lot of mobile phone resources; for mobile phone development including high-end smart phones and low-end mobile phones. , it shows a problem that cannot be generalized. There are also problems that cannot be generalized on other high, medium and low-end terminals similar to the above-mentioned mobile terminal functions.
  • the present invention provides an application communication method for a terminal, so as to solve the problem that the application communication method existing in the prior art solution is not common in high, medium, and low-end terminals.
  • the present invention provides an application communication method for a terminal, and the method includes the following steps:
  • an application that needs to perform application communication registers a message channel in the terminal operating system, and attaches a message processing module of the application to the message channel;
  • the message channel hands the message to the message processing module of the hanging party for processing, thereby completing application communication.
  • the above method further includes the following steps:
  • the message channel is identified by a message channel name string.
  • the application inter-process communication protocol of the terminal operating system is encapsulated to create an application communication message processing object, where the object includes a timely acquisition of the arrival message.
  • the message channel of the signal and the message content and the message processing module processing the message of the channel, the application communication message processing object is hooked as a node in a global linked list, and the application communication message processing object Identified by the message channel name.
  • the foregoing step (1) attaches the message processing module to the message channel by: attaching a monitoring function for monitoring the application communication message processing object in the main loop of the application, and simultaneously processing the message processing module
  • the corresponding callback function pointer is saved as an input parameter to the monitor function.
  • step (2) when another application transmits a message to the application, the application finds a corresponding application communication message processing object in the global linked list by using the message channel name registered by the application, and then The message is directly written to the message channel of the application communication message processing object, thereby completing the transmission of the message.
  • the application detects that a message is written on the message channel of the application communication message processing object in the main loop, the monitoring function is automatically invoked, and the monitoring function will read on the channel. The fetched message is handed over to the message processing module corresponding to the saved input parameter for processing.
  • the another application needs to provide the non-response sending and the responding sending of the sending message in combination with the requirement of the application communication of the terminal, and send and send the response to the message.
  • the other application of the message uses a message channel to specifically process the response message.
  • the above application requiring application communication is a telephone service server, and the other application is a call application, or a short message application, or a phonebook application.
  • the application communication of the present invention is performed in a channel-based manner, the sender sends a message to the channel, and the receiver obtains a message sent by the sender to the channel on the channel, and the message channel passes through the channel name string.
  • the message dispatching function is implemented in the server daemon of the application communication processing of each application, thereby avoiding a background communication server dedicated to a common communication mechanism such as D-BUS; The shortcomings and imperfections of the current technical solutions can be avoided, and the application communication of the high, medium and low-end terminals can be realized simply and efficiently. .
  • FIG. 3 is a flowchart of processing a received message according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a message layer structure of a wireless application interface module
  • FIG. 5 is a message flow diagram of a call application and a telephone service server according to an application example of the present invention
  • FIG. 6 is a schematic diagram of message processing of a telephone service server according to an application example of the present invention.
  • the typical application terminal of the method is a mobile phone terminal.
  • Step A The application that needs to perform application communication registers a message channel in the mobile terminal operating system, and attaches the message processing module of the application to the message channel, so that after the message channel receives the message, the message processing is triggered.
  • the module processes the message;
  • Step B when another application sends a message to the application, the message is sent to the message channel registered by the application in step A;
  • Step C After receiving the message, the message channel hands the message to the message processing module attached in step A for processing, thereby completing application communication of the two applications;
  • Step D When the application communication is aborted, the context structure of the application communication is released, and the message channel registered by the application is cancelled.
  • step A is performed when the mobile phone is turned on, and step D is performed when the mobile phone is in the hand.
  • step A registering a message channel in the mobile terminal operating system needs to be implemented based on the underlying mechanism in the mobile phone system, such as an IPC of the operating system itself, such as a pipe, a socket, or a message queue.
  • Encapsulation to create an object, called the application communication message processing object: GMsgHandler which includes a message channel (registered in step A) that can acquire the signal and message content of the arrival message in time, and process the message of the channel.
  • the message processing module attaches the application communication message processing object as a node in a global linked list (the reason why it needs to be saved in the global linked list is mainly because the specific application (at the time of registration) and the application main loop are required
  • the list is operated; of course, there are many implementation methods.
  • the global variable is to open up a shared memory for the specific application and the application main loop to operate, and the application communication message processing object is identified by the message channel name.
  • Step A attaching the message processing module to the message channel by: attaching a monitoring function for monitoring the object in a main loop of the application
  • the number is used to call the GMsgHandler object after receiving the message arrival signal, and the callback function (also called the hook function) pointer corresponding to the message processing module is saved as an input parameter of the monitoring function.
  • the application detects that the object has data input in the main loop (the object gets a signal arrival message, that is, it knows that the message is received on the channel, there is data input)
  • the monitoring function will be automatically called, and the monitoring is performed.
  • the function will process the message read on this channel to the message processing module corresponding to the input parameter it holds.
  • step B it is required to provide a non-response transmission of the message and a response transmission in response to the demand for the application communication of the mobile phone (for example, after the voice call sends a dialing request to the telephone server, the telephone server session returns a call identifier to the voice call application),
  • the response sends an asynchronous send similar to the message, after the message is sent to the message channel, the other steps can be continued, so it is easy to implement; and the response sends a synchronous send similar to the message, which is waiting for the message to be sent to the message channel.
  • the application's message handler is executed until other steps can continue.
  • Step B the process of step C), so as not to affect the operating efficiency of the system.
  • step C when the application detects that a message is written on the GMsgHandler object in the main loop, the hooked monitoring function is called to process the message.
  • the message channel registration process in the embodiment of the present invention includes the following steps: Step 101: A message channel registration starts;
  • Step 102 The application that needs to perform application communication determines whether the channel is registered in the GMsgHandler global linked list: If yes, go to step 104; otherwise, continue;
  • Step 103 The mobile terminal application that needs to perform application communication registers the message channel and the corresponding processing function in the GMsgHandler linked list (this processing function is a function for processing the received message, that is, a function run by the message processing module);
  • Step 104 the message channel registration ends.
  • the message channel is identified by the channel name string, the message Channel names are unique across the system.
  • the implementation of the message channel depends on the underlying IPC.
  • the message channel is a message queue, and the message channel name is the name of the message queue, which uniquely identifies the message queue.
  • the message sending process of the embodiment of the present invention includes the following steps: Step 201: Sending a message begins;
  • Step 202 The application that sends the message determines whether the corresponding message channel name is empty: if yes, go to step 205; if no, continue;
  • Step 203 The application that sends the message determines whether the message channel is registered in the GMsgHandler list: if not, go to step 205; if yes, continue;
  • Step 204 Send a message on the corresponding message channel by using the underlying IPC, and the process ends; Step 205, the message fails to be sent.
  • the message channel name is unique within the entire system during the message channel registration process shown in Figure 1, in the above message sending process, the message is sent through the registered message channel name in the global linked list.
  • the GMsgHandler object is then written directly to the channel of the GMsgHandler object to complete the message. For example, when the message channel name is the message queue name, writing the message to the channel of the GMsgHandler object copies the message to its corresponding message queue.
  • the process of receiving a message processing in the embodiment of the present invention includes the following steps:
  • Step 301 the bottom layer IPC receives the message
  • Step 302 Put the message into the corresponding message channel
  • Step 303 The application detects the message in the main loop.
  • Step 304 Search for a processing function of the channel in the GMsgHandler linked list.
  • Step 305 The message processing module executes the found processing function on the message.
  • the wireless application interface module has a message layer structure, and the wireless application interface module corresponds to the interface layer, the telephone service server, and the communication processing layer in the figure, and the telephone service server passes the communication processing module (such as an AT command (the AT command is The command that the modem Modem can recognize and execute)) interacts with the wireless module.
  • the wireless application interface module is located between the mobile phone operating system and the application, and functions as a wireless application interface.
  • the wireless application interface module mainly provides a wireless communication request sent by the receiving application, receives a command response sent from the wireless module, receives a notification message sent from the wireless module, ensures the real-time performance of the sending and receiving command, priority control of the command, and the command Parallel processing, exception handling of commands, wireless module data buffering, and establishment of data call link connections.
  • the wireless application interface module communicates with the phone book application, short message application, call application, and the like.
  • the message flow of the application application and the telephone service server of the application instance of the present invention includes the following steps:
  • Step 501 The application that needs to perform application communication registers a message channel in the operating system, and attaches the message processing module to the message channel.
  • the call application needs to register a message channel in the operating system, such as the voice.service (described by string) channel, receive the message sent by the telephony service server, and attach the call to the hook.
  • a message channel in the operating system such as the voice.service (described by string) channel
  • receive the message sent by the telephony service server and attach the call to the hook.
  • the processing function of the successful/failed message (such as making a call when the dialing is successful, and displaying the dialing failure to the user on the mobile phone interface when the dialing fails);
  • the telephony service server To receive messages from the calling application, the telephony service server also needs to register a message channel (as shown in Figure 6), such as the phone.server channel, which is attached to the processing function of the dialed message (the AT command that converts the dialing command into a response). Send to the Modem, apply the call ID of the call to the call, and respond to the call application with a dial success/failure message after receiving the response of the AT command.
  • a message channel as the phone.server channel
  • the call application needs the telephone service server to respond to a call identifier, it needs to use the response message to send, so specially register a message channel syncmsghandler that specifically processes the response message, and attach the response function of the response message, here to the response message. Processing is
  • the call identity and corresponding call context data are saved in the internal data structure.
  • the message channel name and corresponding handler function are stored in the linked list structure of (GMsgHandler).
  • the trigger of receiving the message it can be triggered by such as polling or the underlying driver (here refers to triggering the underlying receiving, the underlying receiving can be detected in the main loop, the main loop is through the underlying event mechanism (such as having a message arrive) ) to drive).
  • the IPC will be triggered to receive the message.
  • the message is dispatched (through the above monitoring function), and the corresponding processing function is searched in the linked list structure of the GMsgHandler according to the message channel name, and the processing function is called to run.
  • the name of the syncmsghandler channel is not empty, indicating that the message sender If a response is required, the response message is sent through the sync.msghandler message channel; the normal response message (such as the AT command response in this example) is sent through the same voice.service message channel as the non-response message.
  • Step 502 The message is sent by searching the corresponding message channel in the GMsgHandler object list, and then sending it through the IPC of the operating system: the call application sends a response dialing message to the channel phone.server, and the phone service server is at the phone.server. Receiving the dialing message on the channel, after receiving the dialing message on the phone.server channel, the telephone service server will call the registered processing function of the call (as shown in FIG. 6);
  • Step 503 The telephone service server determines whether the syncmsghandler message channel is empty: if no, go to step 505; if yes, continue;
  • Step 504 the telephone service server sends an AT response message to the voice.service message channel, and proceeds to the subsequent process, and then proceeds to step 506;
  • Step 505 The telephone service server sends a response message to the syncmsghandler message channel, and performs a subsequent process.
  • Step 506 When the call application communication is aborted, the message channel created in step 501 and the corresponding memory resource are deleted.
  • step 504 the telephone service server sends an AT response message, and after the telephone service server receives the dialing message on the phone.server channel in step 502, the registered call processing function is called, and the two steps have no fixed time sequence. order.
  • the present invention simplifies and conveniently implements application communication between a call application and a telephone service server, and effectively avoids the defect that the application communication method existing in the prior art solution is not common in high, medium, and low-end mobile phone terminals. It ensures fast and efficient porting of application communication in various mobile phones, thus shortening the development cycle and development cost of mobile phone software from one aspect.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephonic Communication Services (AREA)

Abstract

An application communication method for a terminal is disclosed. The method includes: (1) the application needing application communicating registers a message channel in a terminal operation system, and assigns a message processing module of the application on the message channel; (2) message is sent to the message channel registered by the message, when another application sends the message to the application; (3) after the message channel receives the message, the message is transformed to the message processing module, and is processed to finish communication of terminal.

Description

一种终端的应用通信方法  Terminal application communication method
技术领域 Technical field
本发明涉及终端软件领域, 尤其涉及一种终端的应用通信方法。  The present invention relates to the field of terminal software, and in particular, to a method for application communication of a terminal.
背景技术 Background technique
手机终端设备是一种嵌入式软件设备,同时,区别于通用的嵌入式设备, 它具有良好的人机交互性, 满足了人对终端的功能、 样式、 使用习惯等个性 化的要求; 而且随着手机终端的迅猛发展和使用的日益广泛, 需要一个手机 终端能够完成尽可能多的任务, 以方便人们的工作和生活。 因此, 手机终端 设备在内部的嵌入式软件实现中不可避免的存在多个任务, 多个进程, 而这 些多任务多进程之间的应用通信的效率在很大程度上决定了手机终端的性 能高低, 所以手机终端中的应用通信的筒洁、 高效是手机终端软件开发中的 一个关键问题。  The mobile terminal device is an embedded software device. At the same time, it is different from the universal embedded device. It has good human-computer interaction, and satisfies the individual requirements of the functions, styles and usage habits of the human terminal; With the rapid development and use of mobile terminals, a mobile terminal is required to perform as many tasks as possible to facilitate people's work and life. Therefore, the mobile terminal device inevitably has multiple tasks and multiple processes in the internal embedded software implementation, and the efficiency of application communication between these multi-tasking and multi-process determines the performance of the mobile terminal to a large extent. Therefore, the clean and efficient application communication in the mobile terminal is a key issue in the development of mobile terminal software.
应用通信为不同应用程序间通信提供了基本通信功能,不管这些通信的 应用是在同一线程(或进程) 内部还是在不同的线程(或进程)之间。 最基 本的应用通信形式是操作系统提供的 IPC ( InterProcess Communications protocol, 进程间通信协议) , 但是操作系统提供的 IPC形式过于原始, 功 能过于简单, 一般只在编写比较低层的软件系统使用比较适合。  Application communication provides basic communication capabilities for communication between different applications, whether the application of these communications is within the same thread (or process) or between different threads (or processes). The most basic form of application communication is the IPC (InterProcess Communications Protocol) provided by the operating system. However, the IPC format provided by the operating system is too primitive and too simple. It is generally suitable only for writing lower-level software systems.
因此,在手机开发中, 不可避免的需要解决由于操作系统本身的 IPC不 易用且无法直接使用的缺陷,大多数手机开发者都选择了在操作系统 IPC之 上实现自己的应用通信, 除开那些移植困难, 在其他手机上复用需要耗费大 量移植工作的应用通讯机制和方法, 目前,在手机开发中比较有影响的应用 通信方法有 Trolltech公司 QTOPIA软件产品中的 Qt Cop ( QCOP )通信协 议和开源的消息总线系统 D-Bus通信机制。  Therefore, in the development of mobile phones, it is inevitable to solve the defect that the IPC of the operating system itself is not easy to use and cannot be directly used. Most mobile phone developers have chosen to implement their own application communication on the operating system IPC, except for those transplants. Difficulties, reuse of application communication mechanisms and methods that require a lot of porting work on other mobile phones. At present, the most influential application communication methods in mobile phone development are Qt Cop (QCOP) communication protocol and open source in Trolltech QTOPIA software products. The message bus system D-Bus communication mechanism.
QCop通信机制采用了 publish/subscrible模式, 使通信具有很好的扩展 性; 它用于不同的客户之间在同一地址空间内部或者不同的进程之间的通 信。消息的发起者只需要创建一个 QCopEnvelope对象,其中包含通道名称、 消息名称、 参数等; 消息的接收者要想接收消息, 必须首先创建一个The QCop communication mechanism adopts the publish/subscrible mode, which makes the communication very scalable; it is used for communication between different clients within the same address space or between different processes. The originator of the message only needs to create a QCopEnvelope object containing the channel name, Message name, parameters, etc.; the recipient of the message must first create a message in order to receive the message.
QCopChannel对象, 想接收消息的通道标明了同消息发送者之间的对应关 系; 同时, 依托于其内部特有的函数回调机制- -信号-槽机制, QCop通信 机制 f艮好的解决了接收消息和对接收消息的处理关系。 因此对于 Qcop通信 机制, 通信参与者只要知道了 Qcop的消息通道名称, 任意发送者可以发送 任意消息给任意的接收者, 使通信具有艮好的灵活性和扩展性。 但是, 也应 该看到, QCop通信机制其设计的出发点是针对高端智能手机, 因而在结构 的复杂性、运行机制上面并不是很适合中低端手机; 同时, 其面向对象的设 计思想移植到面向过程的设计存在一定的困难,而内部引入的信号-槽机制 使其内部耦合度高; 对手机应用通信而言, QCop通信机制最大的缺陷是不 支持消息的同步发送, 为开发者带来了额外的开发难度。 The QCopChannel object, the channel that wants to receive the message, indicates the correspondence with the sender of the message; at the same time, relying on its internal function callback mechanism-signal-slot mechanism, the QCop communication mechanism solves the received message and The processing relationship for receiving messages. Therefore, for the Qcop communication mechanism, the communication participant only needs to know the message channel name of Qcop, and any sender can send any message to any receiver, which makes the communication have good flexibility and scalability. However, it should also be noted that the design of QCop communication mechanism is aimed at high-end smart phones, so it is not very suitable for low-end and mid-range mobile phones in terms of structural complexity and operation mechanism; at the same time, its object-oriented design ideas are transplanted to face There are certain difficulties in the design of the process, and the internal signal-slot mechanism introduces a high degree of internal coupling. For mobile application communication, the biggest drawback of the QCop communication mechanism is that it does not support synchronous transmission of messages, which brings developers. Additional development difficulty.
D-Bus应用通信是个消息总线系统, 它为应用程序间的通信提供了一个 简单的途径, 该消息总线是建立在普通的一对一消息传输的框架之上。  D-Bus application communication is a message bus system that provides a simple way to communicate between applications. The message bus is built on a common one-to-one message transmission framework.
虽然, 进程通讯最简单的方式是一对一的进程通信, 但是由于 D-BUS 本身是基于总线的。 所以, D-BUS却提供了一个后台服务程序(daemon, 也 称为消息总线后台程序), 它在一个特定的总线上来路由消息, 从而形成了 一个总线拓朴结构,它使得进程可以在同一时间来与一个或多个应用程序通 信, 应用程序可以在总线上发送或侦听各种事件。 可见, 对比 QCop通信机 制, D-BUS 虽然支持消息的同步发送, 但它的实现机制是异常复杂的, 且 需要在系统中专门启动一个后台消息总线服务器,因此比较适合于高端智能 手机框架的应用间通信。  Although the easiest way to process communication is one-to-one process communication, since D-BUS itself is bus-based. Therefore, D-BUS provides a daemon (also known as a message bus daemon) that routes messages on a particular bus, thus forming a bus topology that allows processes to be at the same time. To communicate with one or more applications, applications can send or listen to various events on the bus. It can be seen that compared with the QCop communication mechanism, although D-BUS supports the synchronous transmission of messages, its implementation mechanism is extremely complicated, and it is necessary to specifically start a background message bus server in the system, so it is more suitable for the application of high-end smartphone framework. Communication between.
综上所述, QCop通信协议和 D-Bus应用通信对中低端手机来说, 都显 得结构庞大, 需要耗费大量的手机资源; 对于包括了高端智能手机和中低端 手机的手机开发来说, 就显示出了不能通用的问题。在和上述手机终端功能 类似的其他高、 中、 低端终端上也存在不能通用的问题。  In summary, QCop communication protocol and D-Bus application communication are huge in structure for medium and low-end mobile phones, and require a lot of mobile phone resources; for mobile phone development including high-end smart phones and low-end mobile phones. , it shows a problem that cannot be generalized. There are also problems that cannot be generalized on other high, medium and low-end terminals similar to the above-mentioned mobile terminal functions.
发明内容 Summary of the invention
本发明提供一种终端的应用通信方法,以解决现有技术方案中存在的应 用通信方法在高、 中、 低端终端不通用的问题。 为了解决上述技术问题, 本发明提供一种终端的应用通信方法, 该方法 包括如下步骤: The present invention provides an application communication method for a terminal, so as to solve the problem that the application communication method existing in the prior art solution is not common in high, medium, and low-end terminals. In order to solve the above technical problem, the present invention provides an application communication method for a terminal, and the method includes the following steps:
( 1 )需要进行应用通信的应用在所述终端操作系统中注册一消息通道, 并将所述应用的消息处理模块挂接在所述消息通道上;  (1) an application that needs to perform application communication registers a message channel in the terminal operating system, and attaches a message processing module of the application to the message channel;
( 2 ) 当另一应用向所述应用传输消息时, 将该消息发给该应用所注册 的消息通道;  (2) when another application transmits a message to the application, sending the message to a message channel registered by the application;
( 3 )所述消息通道收到所述消息后, 把该消息交给所述挂锋的消息处 理模块进行处理, 从而完成应用通信。  (3) After receiving the message, the message channel hands the message to the message processing module of the hanging party for processing, thereby completing application communication.
上述方法进一步还包括如下步骤:  The above method further includes the following steps:
( 4 ) 当所述终端的应用通信中止时, 注销所述应用注册的消息通道。 进一步地, 上述方法步骤(3 ) 中, 所述消息通道收到所述消息后, 按 照先进先出的原则把该消息交给所述挂接的消息处理模块进行处理。  (4) When the application communication of the terminal is aborted, the message channel registered by the application is logged out. Further, in the method step (3), after the message channel receives the message, the message is handed over to the attached message processing module for processing according to the principle of first in first out.
进一步地, 上述方法步骤(1 ) .中, 所述消息通道通过消息通道名称字 符串来标识。  Further, in the above method step (1), the message channel is identified by a message channel name string.
进一步地, 上述方法步骤(1 )在注册所述消息通道时, 对所述终端操 作系统的应用进程间通信协议进行封装来创建一个应用通信消息处理对象, 该对象中包括能够及时获取到达消息的信号和消息内容的所述消息通道以 及对该通道的消息进行处理的所述消息处理模块,将所述应用通信消息处理 对象作为一个节点挂接在一个全局链表中,且该应用通信消息处理对象用消 息通道名称来标识。  Further, in the method step (1), when registering the message channel, the application inter-process communication protocol of the terminal operating system is encapsulated to create an application communication message processing object, where the object includes a timely acquisition of the arrival message. The message channel of the signal and the message content and the message processing module processing the message of the channel, the application communication message processing object is hooked as a node in a global linked list, and the application communication message processing object Identified by the message channel name.
上述步骤(1 )通过以下方式将所述消息处理模块挂接在所述消息通道 中:在所述应用的主循环中挂接一个监控该应用通信消息处理对象的监控函 数,同时将消息处理模块对应的回调函数指针作为该监控函数的输入参数保 存起来。  The foregoing step (1) attaches the message processing module to the message channel by: attaching a monitoring function for monitoring the application communication message processing object in the main loop of the application, and simultaneously processing the message processing module The corresponding callback function pointer is saved as an input parameter to the monitor function.
上述步骤(2 ) 中, 当另一应用向所述应用传输消息时, 所述应用通过 该应用注册的所述消息通道名称在所述全局链表中查找到对应的应用通信 消息处理对象,然后将该消息直接写入到该应用通信消息处理对象的消息通 , 道中, 从而完成消息的发送。 上述方法中,当所述应用在主循环中检测到该应用通信消息处理对象的 消息通道上有消息写入时,将会自动调用所述监控函数, 而该监控函数会将 在该通道上读取的消息交给它保存的输入参数对应的消息处理模块来进行 处理。 In the above step (2), when another application transmits a message to the application, the application finds a corresponding application communication message processing object in the global linked list by using the message channel name registered by the application, and then The message is directly written to the message channel of the application communication message processing object, thereby completing the transmission of the message. In the above method, when the application detects that a message is written on the message channel of the application communication message processing object in the main loop, the monitoring function is automatically invoked, and the monitoring function will read on the channel. The fetched message is handed over to the message processing module corresponding to the saved input parameter for processing.
进一步地, 上述方法步骤(2 ) 中, 所述另一应用需要结合所述终端的 应用通信的需求提供所述发送消息的无回应发送和有回应发送,对所述消息 的有回应发送,发送所述消息的所述另一应用采用建一个消息通道来专门处 理回应消息。  Further, in the method step (2), the another application needs to provide the non-response sending and the responding sending of the sending message in combination with the requirement of the application communication of the terminal, and send and send the response to the message. The other application of the message uses a message channel to specifically process the response message.
上述需要进行应用通信的应用为电话业务服务器,所述另一应用为呼叫 应用、 或短消息应用、 或电话本应用。  The above application requiring application communication is a telephone service server, and the other application is a call application, or a short message application, or a phonebook application.
与现有技术相比, 本发明应用通信采用基于通道的方式进行,发送者把 消息发送到通道上,接收者在通道上获取发送者发送到通道上的消息, 消息 通道通过通道名称字符串来标识, 同时在手机终端的嵌入式软件中的,在对 各个应用的应用通信处理的服务器守护进程中实现了消息派发功能,避免了 类似于 D-BUS等常用通讯机制专用的后台通讯服务器; 从而可以避免目前 技术方案存在的缺点和不完善, 简单且高效地实现了高、 中、低端终端的应 用通信。 . 附图概述 Compared with the prior art, the application communication of the present invention is performed in a channel-based manner, the sender sends a message to the channel, and the receiver obtains a message sent by the sender to the channel on the channel, and the message channel passes through the channel name string. At the same time, in the embedded software of the mobile terminal, the message dispatching function is implemented in the server daemon of the application communication processing of each application, thereby avoiding a background communication server dedicated to a common communication mechanism such as D-BUS; The shortcomings and imperfections of the current technical solutions can be avoided, and the application communication of the high, medium and low-end terminals can be realized simply and efficiently. .
图 1为本发明实施例消息通道注册流程图; .  1 is a flow chart of message channel registration according to an embodiment of the present invention;
图 2为本发明实施例消息发送处理流程图;  2 is a flowchart of message sending processing according to an embodiment of the present invention;
图 3为本发明实施例接收消息处理流程图;  3 is a flowchart of processing a received message according to an embodiment of the present invention;
图 4为无线应用接口模块消息层结构示意图;  4 is a schematic diagram of a message layer structure of a wireless application interface module;
图 5为本发明应用实例呼叫应用与电话业务服务器的消息流程图; 图 6为本发明应用实例电话业务服务器消息处理示意图。  FIG. 5 is a message flow diagram of a call application and a telephone service server according to an application example of the present invention; FIG. 6 is a schematic diagram of message processing of a telephone service server according to an application example of the present invention.
本发明的较佳实施方式 以下结合附图和具体实施方式对本发明所述技术方案进行详细描述。 本发明所述一种终端的应用通信方法中,所述方法的典型应用终端为手 机终端。 Preferred embodiment of the invention The technical solutions of the present invention are described in detail below in conjunction with the accompanying drawings and specific embodiments. In the application communication method of the terminal, the typical application terminal of the method is a mobile phone terminal.
本发明实施例一种手机终端的应用通信方法, 包括如下步驟:  An application communication method of a mobile phone terminal according to an embodiment of the present invention includes the following steps:
步骤 A,需要进行应用通信的应用在所述手机终端操作系统中注册一消 息通道, 并将该应用的消息处理模块挂接在所述消息通道上, 以便消息通道 接收到消息后, 触发消息处理模块对消息进行处理;  Step A: The application that needs to perform application communication registers a message channel in the mobile terminal operating system, and attaches the message processing module of the application to the message channel, so that after the message channel receives the message, the message processing is triggered. The module processes the message;
步骤 B, 当另一应用向所述应用发送消息时,将该消息发给步骤 A中该 应用所注册的消息通道;  Step B, when another application sends a message to the application, the message is sent to the message channel registered by the application in step A;
步骤 C, 消息通道收到消息后,把该消息交给步骤 A中挂接的消息处理 模块进行处理, 从而完成两个应用的应用通信;  Step C: After receiving the message, the message channel hands the message to the message processing module attached in step A for processing, thereby completing application communication of the two applications;
步骤 D, 当应用通信中止时, 释放该应用通信的上下文结构, 注销应用 所注册的消息通道。  Step D: When the application communication is aborted, the context structure of the application communication is released, and the message channel registered by the application is cancelled.
此处释放资源, 别的应用不会再发送消息, 即使发送也不会被处理, 如 果别的应用还要发送消息, 就不会执行步骤 D, 所以, 如果这时发送消息会 告警, 提示发送失败。 一般来说, 步骤 A是手机开机时进行, 步骤 D是手 机关机时进行。  The resources are released here, other applications will not send messages any more, even if they are sent, they will not be processed. If other applications still send messages, step D will not be executed. Therefore, if the message is sent, an alert will be sent. failure. Generally, step A is performed when the mobile phone is turned on, and step D is performed when the mobile phone is in the hand.
其中, 步骤 A 中, 在手机终端操作系统中注册一消息通道, 需要基于 手机系统中的底层机制来实现, 对操作系统本身的 IPC, 比如管道(pipe ) 、 套接字 (socket ) 、 消息队列等进行封装来创建一个对象, 称为应用通信消 息处理对象: GMsgHandler, 该对象中包括能够及时获取到达消息的信号和 消息内容的消息通道(步驟 A 中注册的) 以及对该通道的消息进行处理的 所述消息处理模块,将所述应用通信消息处理对象作为一个节点挂接在一个 全局链表中(之所以需要保存在全局链表中,主要是因为具体应用(注册时) 和应用主循环都需要操作该链表; 当然实现方法很多, 全局变量某种意义上 是开辟一段共享内存供具体应用和应用主循环来操作),且该应用通信消息 处理对象用消息通道名称来标识。 步骤 A通过以下方式将所述消息处理模 块挂接在所述消息通道中:在应用的主循环中挂接一个监控该对象的监控函 数, 以用于该 GMsgHandler对象在接收到消息到达信号后进行调用, 同时 将消息处理模块对应的回调函数(又叫钩子函数)指针作为该监控函数的输 入参数保存起来。 这样, 当应用在主循环中检测到该对象有数据输入时(该 对象得到一个消息到达的信号, 即得知通道上收到消息, 有数据输入) , 将 会自动调用该监控函数,而监控函数会将在该通道上读取的消息交给它保存 的输入参数对应的消息处理模块来进行处理。 In step A, registering a message channel in the mobile terminal operating system needs to be implemented based on the underlying mechanism in the mobile phone system, such as an IPC of the operating system itself, such as a pipe, a socket, or a message queue. Encapsulation to create an object, called the application communication message processing object: GMsgHandler, which includes a message channel (registered in step A) that can acquire the signal and message content of the arrival message in time, and process the message of the channel. The message processing module attaches the application communication message processing object as a node in a global linked list (the reason why it needs to be saved in the global linked list is mainly because the specific application (at the time of registration) and the application main loop are required The list is operated; of course, there are many implementation methods. The global variable is to open up a shared memory for the specific application and the application main loop to operate, and the application communication message processing object is identified by the message channel name. Step A: attaching the message processing module to the message channel by: attaching a monitoring function for monitoring the object in a main loop of the application The number is used to call the GMsgHandler object after receiving the message arrival signal, and the callback function (also called the hook function) pointer corresponding to the message processing module is saved as an input parameter of the monitoring function. In this way, when the application detects that the object has data input in the main loop (the object gets a signal arrival message, that is, it knows that the message is received on the channel, there is data input), the monitoring function will be automatically called, and the monitoring is performed. The function will process the message read on this channel to the message processing module corresponding to the input parameter it holds.
步骤 B中,需要结合手机的应用通信的需求提供消息的无回应发送和有 回应发送(如语音呼叫向电话服务器发送一个拨号请求后, 电话服务器会话 会向语音呼叫应用返回一个呼叫标识),无回应发送类似于消息的异步发送, 将消息发送到消息通道后就可继续执行其它步骤, 因而很容易实现; 而有回 应发送类似于消息的同步发送,是将消息发送到消息通道后一直等待该应用 的消息处理函数被执行为止才可继续执行其它步骤。  In step B, it is required to provide a non-response transmission of the message and a response transmission in response to the demand for the application communication of the mobile phone (for example, after the voice call sends a dialing request to the telephone server, the telephone server session returns a call identifier to the voice call application), The response sends an asynchronous send similar to the message, after the message is sent to the message channel, the other steps can be continued, so it is easy to implement; and the response sends a synchronous send similar to the message, which is waiting for the message to be sent to the message channel. The application's message handler is executed until other steps can continue.
考虑到在中低端手机的单任务框架中,如果采用单纯的阻塞方式会造成 系统的死循环,在应用通信的发送时一般采用新建一个通道来专门处理回应 消息(此时, 重复步骤八、 步骤 B、 步骤 C的过程) , 从而不会影响系统的 运行效率。  Considering that in the single-task framework of the low-end mobile phone, if the simple blocking mode will cause the system to die, in the application communication, a new channel is generally used to process the response message (in this case, repeat step 8). Step B, the process of step C), so as not to affect the operating efficiency of the system.
步驟 C中, 当该应用在主循环中检测到该 GMsgHandler对象上有消息 写入时, 调用所述挂接的监控函数对所述消息进行处理。  In step C, when the application detects that a message is written on the GMsgHandler object in the main loop, the hooked monitoring function is called to process the message.
如图 1所示, 本发明实施例消息通道注册流程, 包括如下步驟: 步骤 101 , 消息通道注册开始; As shown in FIG. 1, the message channel registration process in the embodiment of the present invention includes the following steps: Step 101: A message channel registration starts;
步骤 102, 需要进行应用通信的应用判断该通道是否已在 GMsgHandler 全局链表中注册: 如是, 则转步驟 104; 否则, 继续;  Step 102: The application that needs to perform application communication determines whether the channel is registered in the GMsgHandler global linked list: If yes, go to step 104; otherwise, continue;
步骤 103,需要进行应用通信的手机终端应用在 GMsgHandler链表中注 册该消息通道以及相应的处理函数(这个处理函数是对收到的消息进行处理 的函数, 即消息处理模块运行的函数) ;  Step 103: The mobile terminal application that needs to perform application communication registers the message channel and the corresponding processing function in the GMsgHandler linked list (this processing function is a function for processing the received message, that is, a function run by the message processing module);
步骤 104, 消息通道注册结束。  Step 104, the message channel registration ends.
上述消息通道注册流程中, 消息通道通过通道名称字符串来标识, 消息 通道名称在整个系统范围内具有唯一性。其中, 消息通道的实现依赖于底层 的 IPC, 比如对应于消息队列机制来说, 消息通道就是一个消息队列, 消息 通道名称就是消息队列的名称, 唯一标识该消息队列。 In the above message channel registration process, the message channel is identified by the channel name string, the message Channel names are unique across the system. The implementation of the message channel depends on the underlying IPC. For example, corresponding to the message queue mechanism, the message channel is a message queue, and the message channel name is the name of the message queue, which uniquely identifies the message queue.
如图 2所示, 本发明实施例消息发送处理流程, 包括如下步骤: 步骤 201, 消息发送开始; As shown in FIG. 2, the message sending process of the embodiment of the present invention includes the following steps: Step 201: Sending a message begins;
步骤 202, 发送消息的应用判断对应的消息通道名是否为空: 如是, 则 转步骤 205; 如否, 则继续;  Step 202: The application that sends the message determines whether the corresponding message channel name is empty: if yes, go to step 205; if no, continue;
步骤 203,发送消息的应用判断消息通道在 GMsgHandler链表中是否注 册: 如否, 则转步骤 205; 如是, 则继续;  Step 203: The application that sends the message determines whether the message channel is registered in the GMsgHandler list: if not, go to step 205; if yes, continue;
步骤 204, 通过底层 IPC在对应的消息通道上发送消息, 流程结束; 步骤 205, 消息发送失败。  Step 204: Send a message on the corresponding message channel by using the underlying IPC, and the process ends; Step 205, the message fails to be sent.
由于图 1所示的消息通道注册过程中,消息通道名称在整个系统范围内 具有唯一性, 因此, 上述消息发送处理流程中, 消息发送是通过已注册的消 息通道名在全局链表中查找到对应的 GMsgHandler对象, 然后将该消息直 接写入到该 GMsgHandler对象的通道中, 从而完成消息的发送。 比如消息 通道名称为消息队列名称时, 把消息写入到 GMsgHandler对象的通道中就 是把消息拷贝到其对应的消息队列中。  Because the message channel name is unique within the entire system during the message channel registration process shown in Figure 1, in the above message sending process, the message is sent through the registered message channel name in the global linked list. The GMsgHandler object is then written directly to the channel of the GMsgHandler object to complete the message. For example, when the message channel name is the message queue name, writing the message to the channel of the GMsgHandler object copies the message to its corresponding message queue.
如图 3所示, 本发明实施例接收消息处理流程, 包括如下步骤: As shown in FIG. 3, the process of receiving a message processing in the embodiment of the present invention includes the following steps:
步骤 301, 底层 IPC接收到消息;  Step 301, the bottom layer IPC receives the message;
步骤 302, 将消息放入相应的消息通道中;  Step 302: Put the message into the corresponding message channel;
步骤 303, 应用在主循环中检测到消息;  Step 303: The application detects the message in the main loop.
步骤 304, 在 GMsgHandler链表中查找该通道桂接的处理函数; 步骤 305, 消息处理模块对该消息执行查找到的处理函数。  Step 304: Search for a processing function of the channel in the GMsgHandler linked list. Step 305: The message processing module executes the found processing function on the message.
以下为一个本发明实际应用的具体实例,考虑到手机无线应用模块同上 层应用交互, 需要处理大量的应用通信,故下面结合手机无线应用接口模块 的应用通信进行说明。 The following is a specific example of the practical application of the present invention, considering that the mobile phone wireless application module is the same as above. Layer application interaction requires a large amount of application communication, so the following describes the application communication of the mobile phone wireless application interface module.
如图 4所示, 无线应用接口模块消息层结构示意图, 无线应用接口模块 对应于图中的接口层、 电话业务服务器、 通讯处理层, 电话业务服务器通过 通讯处理模块(比如 AT命令( AT命令是调制解调器 Modem可以识别并执 行的命令) )同无线模块进行交互。 无线应用接口模块位于手机操作系统与 应用程序之间,起到无线应用接口的作用。 无线应用接口模块主要提供接收 应用发来的无线通讯请求,接收从无线模块发来的命令响应,接收从无线模 块发来的通知消息, 保证收发命令的实时性, 命令的优先级控制, 命令的并 行处理, 命令的异常处理, 无线模块数据緩冲和建立数据呼叫链路连接等。 无线应用接口模块鴛要同电话本应用、短消息应用、呼叫应用等进行应用通 信。  As shown in FIG. 4, the wireless application interface module has a message layer structure, and the wireless application interface module corresponds to the interface layer, the telephone service server, and the communication processing layer in the figure, and the telephone service server passes the communication processing module (such as an AT command (the AT command is The command that the modem Modem can recognize and execute)) interacts with the wireless module. The wireless application interface module is located between the mobile phone operating system and the application, and functions as a wireless application interface. The wireless application interface module mainly provides a wireless communication request sent by the receiving application, receives a command response sent from the wireless module, receives a notification message sent from the wireless module, ensures the real-time performance of the sending and receiving command, priority control of the command, and the command Parallel processing, exception handling of commands, wireless module data buffering, and establishment of data call link connections. The wireless application interface module communicates with the phone book application, short message application, call application, and the like.
如图 5 所示, 为本发明应用实例呼叫应用与电话业务^^务器的消息流 程, 包括如下步骤:  As shown in FIG. 5, the message flow of the application application and the telephone service server of the application instance of the present invention includes the following steps:
步骤 501, 需要进行应用通信的应用在操作系统中注册一个消息通道, 并挂接消息处理模块到该消息通道上;  Step 501: The application that needs to perform application communication registers a message channel in the operating system, and attaches the message processing module to the message channel.
呼叫应用要同电话业务服务器进行应用通信,就需要在操作系统注册一 个消息通道, 比如叫做 voice.service (使用字符串进行描述)通道, 接收电 话业务服务器发送来的消息, 挂接处理接收到拨号成功 /失败的消息的处理 函数(比如拨号成功时进行通话,拨号失败时在手机界面向用户显示拨号失 败) ;  To apply communication with the telephony service server, the call application needs to register a message channel in the operating system, such as the voice.service (described by string) channel, receive the message sent by the telephony service server, and attach the call to the hook. The processing function of the successful/failed message (such as making a call when the dialing is successful, and displaying the dialing failure to the user on the mobile phone interface when the dialing fails);
电话业务服务器要接收来自呼叫应用的消息,也需要注册一个消息通道 (如图 6所示) , 比如叫做 phone.server通道, 挂接对拨号消息的处理函数 (把拨号命令转换为响应的 AT命令发送到 Modem,向呼叫应用回应该次呼 叫的呼叫标识,在接收到 AT命令的响应后向呼叫应用回应拨号成功 /失败消 息等) 。  To receive messages from the calling application, the telephony service server also needs to register a message channel (as shown in Figure 6), such as the phone.server channel, which is attached to the processing function of the dialed message (the AT command that converts the dialing command into a response). Send to the Modem, apply the call ID of the call to the call, and respond to the call application with a dial success/failure message after receiving the response of the AT command.
同时因为呼叫应用需要电话业务服务器响应一个呼叫标识, 所以, 需要 使用有响应的消息发送, 因此特地注册一个专门处理响应消息的消息通道 syncmsghandler, 并且挂接响应消息的处理函数, 此处对响应消息的处理是 在内部数据结构中保存呼叫标识以及对应的呼叫上下文数据。 At the same time, because the call application needs the telephone service server to respond to a call identifier, it needs to use the response message to send, so specially register a message channel syncmsghandler that specifically processes the response message, and attach the response function of the response message, here to the response message. Processing is The call identity and corresponding call context data are saved in the internal data structure.
在手机终端操作系统中注册消息通道, 需要在应用通信消息处理对象 Registering a message channel in the mobile terminal operating system requires an application communication message processing object
( GMsgHandler )的链表结构中保存该消息通道名称和相应的处理函数。 至 于接收消息的触发可以采取诸如轮询或是底层驱动来触发(这里指的是触发 底层的接收,底层接收后才能在主循环中检测到, 主循环是通过底层的事件 机制(比如有消息抵达)来驱动的)。 这样一旦有消息抵达, 会触发 IPC对 消息进行接收, 消息的派发 (通过上文的监控函数实现)则根据消息通道名 称在 GMsgHandler的链表结构中查找对应的处理函数, 并且调用该处理函 数进行运行 The message channel name and corresponding handler function are stored in the linked list structure of (GMsgHandler). As for the trigger of receiving the message, it can be triggered by such as polling or the underlying driver (here refers to triggering the underlying receiving, the underlying receiving can be detected in the main loop, the main loop is through the underlying event mechanism (such as having a message arrive) ) to drive). In this way, once a message arrives, the IPC will be triggered to receive the message. The message is dispatched (through the above monitoring function), and the corresponding processing function is searched in the linked list structure of the GMsgHandler according to the message channel name, and the processing function is called to run.
其中, 需要说明的是对有回应消息的发送和接收。 由于对中低端手机的 单任务框架来说, 不可能采用阻塞回应的方式, 以避免整个系统运行低效。 可以采用一个专门的处理回应消息的消息通道的方法来解决这个问题。这就 需要额外注册一个消息通道 sync.msghandler, 有回应的消息发送时, 在发送 消息体中记录 syncmsghandler通道的名称, 一旦消息接收方解析消息发现 syncmsghandler通道的名称不为空, 表明该消息发送方需要回应, 则回应消 息通过 sync.msghandler消息通道发送; 正常的响应消息(如本实例中的 AT 命令响应等)还是通过和无回应消息一样的 voice.service消息通道进行发送。  Among them, what needs to be explained is the sending and receiving of the response message. Due to the single-task framework for low-end and mid-range handsets, it is not possible to use a blocking response to avoid inefficient operation of the entire system. This problem can be solved by a special method of handling the message channel of the response message. This requires an additional registration of a message channel sync.msghandler. When a response message is sent, the name of the syncmsghandler channel is recorded in the sending message body. Once the message receiver resolves the message, the name of the syncmsghandler channel is not empty, indicating that the message sender If a response is required, the response message is sent through the sync.msghandler message channel; the normal response message (such as the AT command response in this example) is sent through the same voice.service message channel as the non-response message.
步骤 502,消息的发送是通过在 GMsgHandler对象链表中查找对应的消 息通道,然后通过操作系统的 IPC进行发送的:呼叫应用向通道 phone.server 发送有回应的拨号消息, 电话业务服务器在 phone.server通道上接收该拨号 消息, 电话业务服务器在 phone.server通道上接收到拨号消息后, 会去调用 注册的对呼叫的处理函数处理(如图 6所示) ;  Step 502: The message is sent by searching the corresponding message channel in the GMsgHandler object list, and then sending it through the IPC of the operating system: the call application sends a response dialing message to the channel phone.server, and the phone service server is at the phone.server. Receiving the dialing message on the channel, after receiving the dialing message on the phone.server channel, the telephone service server will call the registered processing function of the call (as shown in FIG. 6);
步骤 503, 电话业务服务器判断 syncmsghandler消息通道是否为空: 如 否, 则转步骤 505; 如是, 则继续;  Step 503: The telephone service server determines whether the syncmsghandler message channel is empty: if no, go to step 505; if yes, continue;
步骤 504, 电话业务服务器向 voice.service消息通道发送 AT响应消息, 进行后续流程, 然后转至步骤 506;  Step 504, the telephone service server sends an AT response message to the voice.service message channel, and proceeds to the subsequent process, and then proceeds to step 506;
步骤 505, 电话业务服务器向 syncmsghandler消息通道发送回应消息, 进行后续流程; 步骤 506, 当此呼叫应用通信中止时, 注销步骤 501中创建的消息通道 以及相应的内存资源。 Step 505: The telephone service server sends a response message to the syncmsghandler message channel, and performs a subsequent process. Step 506: When the call application communication is aborted, the message channel created in step 501 and the corresponding memory resource are deleted.
上述步骤 504中电话业务服务器发送 AT响应消息, 与步骤 502中电话 业务服务器在 phone.server通道上接收到拨号消息后 , 去调用注册的对呼叫 的处理函数处理, 这两步没有固定的时间先后顺序。  In the above step 504, the telephone service server sends an AT response message, and after the telephone service server receives the dialing message on the phone.server channel in step 502, the registered call processing function is called, and the two steps have no fixed time sequence. order.
工业实用性 本发明简洁方便地实现了呼叫应用同电话业务服务器之间的应用通信, 有效避免了目前现有技术方案中存在的应用通信方法在高、 中、低端手机终 端不通用的缺陷,保证了在各种手机中快速高效的移植应用通信,从而从一 个方面缩短了手机软件的开发周期和开发成本。 INDUSTRIAL APPLICABILITY The present invention simplifies and conveniently implements application communication between a call application and a telephone service server, and effectively avoids the defect that the application communication method existing in the prior art solution is not common in high, medium, and low-end mobile phone terminals. It ensures fast and efficient porting of application communication in various mobile phones, thus shortening the development cycle and development cost of mobile phone software from one aspect.

Claims

权 利 要 求 书 Claim
1、 一种终端的应用通信方法, 其特征在于, 包括如下步骤: An application communication method for a terminal, comprising the steps of:
( 1 )需要进行应用通信的应用在所述终端操作系统中注册一消息通道, 并将所述应用的消息处理模块挂接在所述消息通道上;  (1) an application that needs to perform application communication registers a message channel in the terminal operating system, and attaches a message processing module of the application to the message channel;
( 2 ) 当另一应用向所述应用传输消息时, 将该消息发给该应用所注册 的消息通道;  (2) when another application transmits a message to the application, sending the message to a message channel registered by the application;
( 3 ) 所述消息通道收到所述消息后, 把该消息交给所述挂接的消息处 理模块进行处理, 从而完成应用通信。  (3) After receiving the message, the message channel hands the message to the attached message processing module for processing, thereby completing application communication.
2、 如权利要求 1所述方法, 其特征在于, 所述方法还包括如下步骤: ( 4 ) 当所述终端的应用通信中止时, 注销所述应用注册的消息通道。  2. The method according to claim 1, wherein the method further comprises the following steps: (4) When the application communication of the terminal is suspended, the message channel registered by the application is logged out.
3、 如权利要求 1所述方法, 其特征在于, 步骤(3 ) 中, 所述消息通道 收到所述消息后,按照先进先出的原则把该消息交给所述挂接的消息处理模 块进行处理。  3. The method according to claim 1, wherein in step (3), after receiving the message, the message channel hands the message to the attached message processing module according to a first in first out principle. Process it.
4、 如权利要求 1所述方法, 其 征在于, 步骤( 1 ) 中, 所述消息通道 通过消息通道名称字符串来标识。  4. The method of claim 1, wherein in step (1), the message channel is identified by a message channel name string.
5、 如权利要求 1所述方法, 其特征在于, 步骤( 1 )在注册所述消息通 道时,对所述终端操作系统的应用进程间通信协议进行封装来创建一个应用 通信消息处理对象,该对象中包括能够及时获取到达消息的信号和消息内容 的所述消息通道以及对该通道的消息进行处理的所述消息处理模块,将所述 应用通信消息处理对象作为一个节点挂接在一个全局链表中,且该应用通信 消息处理对象用消息通道名称来标识。  5. The method according to claim 1, wherein step (1), when registering the message channel, encapsulating an application inter-process communication protocol of the terminal operating system to create an application communication message processing object, The object includes the message channel capable of timely acquiring the signal of the arrival message and the message content, and the message processing module for processing the message of the channel, and attaching the application communication message processing object as a node to a global linked list And the application communication message processing object is identified by a message channel name.
6、 如权利要求 5所述方法, 其特征在于, 步骤(1 )通过以下方式将所 述消息处理模块挂接在所述消息通道中:在所述应用的主循环中挂接一个监 控该应用通信消息处理对象的监控函数,同时将消息处理模块对应的回调函 数指针作为该监控函数的输入参数保存起来。  The method of claim 5, wherein the step (1) attaches the message processing module to the message channel by: attaching a monitoring application to the main loop of the application The monitoring function of the communication message processing object, and the callback function pointer corresponding to the message processing module is saved as an input parameter of the monitoring function.
7、 如权利要求 6所述方法, 其特征在于, 步骤(2 ) 中, 当另一应用向 所述应用传输消息时,所述应用通过该应用注册的所述消息通道名称在所述 全局链表中查找到对应的应用通信消息处理对象,然后将该消息直接写入到 该应用通信消息处理对象的消息通道中, 从而完成消息的发送。 The method according to claim 6, wherein in step (2), when another application transmits a message to the application, the message channel name registered by the application through the application is in the The corresponding application communication message processing object is found in the global linked list, and then the message is directly written into the message channel of the application communication message processing object, thereby completing the sending of the message.
8、 如权利要求 7所述方法, 其特征在于, 当所述应用在主循环中检测 到该应用通信消息处理对象的消息通道上有消息写入时,将会自动调用所述 监控函数,而该监控函数会将在该通道上读取的消息交给它保存的输入参数 对应的消息处理模块来进行处理。  8. The method according to claim 7, wherein the monitoring function is automatically invoked when the application detects that a message is written on a message channel of the application communication message processing object in the main loop, and The monitoring function will process the message read on the channel to the message processing module corresponding to the input parameter it holds for processing.
9、 如权利要求 1所述方法, 其特征在于, 步骤(2 ) 中, 所述另一应用 需要结合所述终端的应用通信的需求提供所述发送消息的无回应发送和有 回应发送,对所述消息的有回应发送,发送所述消息的所述另一应用采用建 一个消息通道来专门处理回应消息。  The method according to claim 1, wherein in step (2), the another application needs to provide non-response sending and response sending of the sending message in combination with the requirement of application communication of the terminal, The message is sent in response, and the other application that sent the message uses a message channel to specifically process the response message.
10、 如权利要求 1 ~ 9任一所述方法, 其特征在于, 所述需要进行应用 通信的应用为电话业务服务器, 所述另一应用为呼叫应用、 或短消息应用、 或电话本应用。  The method according to any one of claims 1 to 9, wherein the application requiring application communication is a telephone service server, and the other application is a call application, or a short message application, or a phonebook application.
PCT/CN2007/003763 2007-10-12 2007-12-25 Application communication method for terminal WO2009046593A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200710164043.3 2007-10-12
CN2007101640433A CN101141742B (en) 2007-10-12 2007-10-12 Application communication method of terminal

Publications (1)

Publication Number Publication Date
WO2009046593A1 true WO2009046593A1 (en) 2009-04-16

Family

ID=39193421

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2007/003763 WO2009046593A1 (en) 2007-10-12 2007-12-25 Application communication method for terminal

Country Status (2)

Country Link
CN (1) CN101141742B (en)
WO (1) WO2009046593A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101651863B (en) * 2008-08-14 2012-07-04 中兴通讯股份有限公司 Message sending method based on software bus extension
CN101882068B (en) * 2009-05-08 2013-04-03 上海科泰世纪科技有限公司 Method for mandating component object and data processing device
CN103095656A (en) * 2011-11-03 2013-05-08 陈璧超 Equal communication method, communication nodes and equal communication system
CN103902390B (en) * 2014-03-12 2017-04-19 深圳创维-Rgb电子有限公司 Inter-process communication method based on Android application layer and basis application communication system
JP6524606B2 (en) * 2014-03-25 2019-06-05 セイコーエプソン株式会社 Display control device and display device
CN105404557A (en) * 2015-12-07 2016-03-16 中国电子科技集团公司第五十研究所 Interprocess communication method based on message queue
CN107391630B (en) * 2017-07-10 2020-03-31 北京京东尚科信息技术有限公司 Method and device for processing parallel network requests and terminal equipment
CN107656826B (en) * 2017-09-19 2020-06-26 光一科技股份有限公司 Object-oriented electricity consumption information acquisition terminal based on IPC dynamic maintenance technology
CN110750684B (en) * 2018-07-06 2022-08-16 武汉斗鱼网络科技有限公司 Message prompting method for multi-dimensional verification, storage medium, electronic device and system
CN110177126A (en) * 2019-04-04 2019-08-27 口碑(上海)信息技术有限公司 Data communication method, the apparatus and system in unified message channel
CN113835909B (en) * 2021-09-30 2023-10-24 中国电子科技集团公司第二十八研究所 Application integration method based on message frame

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1297656A (en) * 1998-03-23 2001-05-30 诺基亚网络有限公司 Services on demand in mobile communication system
CN1400748A (en) * 2001-07-31 2003-03-05 皇家菲利浦电子有限公司 Reservation method between terminal and base station of communication system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2412762B (en) * 2004-04-02 2009-01-28 Symbian Software Ltd Inter process communication in a computing device
US7219198B2 (en) * 2004-06-22 2007-05-15 International Business Machines Corporation Facilitating communication within shared memory environments using lock-free queues
CN100392599C (en) * 2006-01-10 2008-06-04 杭州东信灵通电子实业公司 Universal interprocess communication achieving method
CN100403739C (en) * 2006-02-14 2008-07-16 华为技术有限公司 News transfer method based on chained list process
CN100512305C (en) * 2006-03-15 2009-07-08 华为技术有限公司 Process transfer method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1297656A (en) * 1998-03-23 2001-05-30 诺基亚网络有限公司 Services on demand in mobile communication system
CN1400748A (en) * 2001-07-31 2003-03-05 皇家菲利浦电子有限公司 Reservation method between terminal and base station of communication system

Also Published As

Publication number Publication date
CN101141742B (en) 2011-08-10
CN101141742A (en) 2008-03-12

Similar Documents

Publication Publication Date Title
WO2009046593A1 (en) Application communication method for terminal
AU2014269271B2 (en) Electronic device using logical channels for communication
WO2013097452A1 (en) Method for receiving data, method for transmitting data, mobile terminal, and server
CN101281480B (en) Method for realizing sleep function in embedded system
CN103281797A (en) Mobile terminal and method of transmitting business data by same
WO2012009936A1 (en) Cluster management system and method
CN101222483A (en) Service triggering method, system and service trigger equipment
CN109639829A (en) Communication means, communication unit, service support unit and system based on service
WO2012100717A1 (en) Method, system and network element for initiating active paging
WO2013185441A1 (en) Device and method of driving multi-pdp data communication for mobile broadband device
WO2023083038A1 (en) Multi-registration center data processing method and apparatus, device, and storage medium
WO2008025198A1 (en) Method, system, and apparatus for communication between a terminal and a server
WO2012151998A1 (en) Data processing method and drive apparatus for mobile broadband device
WO2011072537A1 (en) Apparatus, method and system for processing at commands
CN113329042B (en) Message processing method and system, internet of vehicles system, server and electronic equipment
WO2010130131A1 (en) System and method for parallel processing of equipment management tasks
EP2391094B1 (en) Network telephony appliance and system supporting wireless internet telephony
WO2007009386A1 (en) A method and system for realizing the supplementary service related to the hook flash
EP2173110B1 (en) A realizing method for re-answering call
CN101110786A (en) Unified information system based on soft switching network
CN102262533B (en) Terminal, triggering method and communication method of application programs between terminals
CN101820691A (en) The method and the mobile telephone terminal that can merge the telephone service on the heterogeneous network
WO2009036621A1 (en) A call initiating method for digital trunking communication terminal
WO2012071860A1 (en) Synchronization communication method between single-boards of a multiple dwelling unit and multiple dwelling unit thereof
CN103354547B (en) Control the system and method for speech connection

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 07855769

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 07855769

Country of ref document: EP

Kind code of ref document: A1