WO2008025198A1 - Method, system, and apparatus for communication between a terminal and a server - Google Patents

Method, system, and apparatus for communication between a terminal and a server Download PDF

Info

Publication number
WO2008025198A1
WO2008025198A1 PCT/CN2007/001120 CN2007001120W WO2008025198A1 WO 2008025198 A1 WO2008025198 A1 WO 2008025198A1 CN 2007001120 W CN2007001120 W CN 2007001120W WO 2008025198 A1 WO2008025198 A1 WO 2008025198A1
Authority
WO
WIPO (PCT)
Prior art keywords
request message
server
unit
terminal
message
Prior art date
Application number
PCT/CN2007/001120
Other languages
French (fr)
Chinese (zh)
Inventor
Ting Wang
Original Assignee
Huawei Technologies Co., Ltd.
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 Huawei Technologies Co., Ltd. filed Critical Huawei Technologies Co., Ltd.
Publication of WO2008025198A1 publication Critical patent/WO2008025198A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/08Access security
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/02Terminal devices

Definitions

  • the present invention belongs to the field of communication technologies, and in particular, to a method, system and apparatus for communication between a terminal and a server.
  • Brew Binary Runtime Environment for Wireless , the wireless binary runtime environment Xi 1 J
  • Brew Binary Runtime Environment for Wireless
  • Xi 1 J the wireless binary runtime environment Xi 1 J
  • the Brew platform is the basic platform for developing and running value-added services. Inside the wireless terminal, the communication between the Brew platform-based application (Applet) and other applications or the underlying platform is asynchronous, that is, after the sender sends the data, the sender does not need to wait for the response to be sent back, and then sends the next packet. This method is suitable for stand-alone applications that do not require a server. However, the future communication network will be centered on data services and generally use Internet IP (Internet Protocol). The entire network will use the IP protocol as a unified communication protocol.
  • Internet Protocol Internet Protocol
  • the so-called Everything Over IP (all based on Internet Protocol), the network only plays the role of information transmission, all value-added services are completed by the terminal outside the network, therefore, the terminal application will become more and more complex, requiring the support of the business server.
  • an application application server
  • IMS IP Multi-media Sub-system
  • the Brew wireless terminal also needs to support C/. S (Client/Server, Client/Server), B/S (Browser/Server, Browser/Server) application.
  • Terminal application A needs to complete the function of deleting a server record (Funcl), if the server successfully deletes the record Record, the terminal application A continues to complete some other function (referred to as Func2); if the server fails to delete the record, the terminal application A completes some other function (called Func3).
  • the above requirements require different processing according to different processing results of the server, that is, the Func2 is successfully continued, and the Func3 is failed. Therefore, the terminal application must receive the response sent by the server before processing.
  • the terminal application must perform synchronous conversion control on Funcl, that is, the terminal application A must wait for the server to return the processing result of Funcl before continuing other operations.
  • Embodiments of the present invention provide a method, system, and apparatus for communication between a terminal and a server, which can convert asynchronous communication on a single-thread platform into synchronous communication.
  • An embodiment of the present invention provides a method for a terminal to communicate with a server, which is used in a system for a single-threaded platform.
  • the method includes: the terminal sends a strange request message to the server and locks the user interface; and the terminal receives the return from the server.
  • the response message of the request message is described, the user interface lock is processed and released according to the preset callback method corresponding to the request message.
  • the embodiment of the present invention further provides an apparatus for a terminal and a server to communicate through a single-threaded platform, where the apparatus includes: a storage unit, configured to store callback information, where the callback information includes at least a request message sent by the terminal. a callback processing unit, configured to: when the terminal sends the request message, lock the user interface, and when the terminal receives the response message of the request message returned by the server, invoke the corresponding request message stored in the storage unit The callback information is processed and the user interface is unlocked.
  • the embodiment of the present invention further provides a terminal, including an application unit, a single-thread platform, and a user interface, and further includes an blocking control, where: an application unit, configured to preset callback information to the blocking control, send a request message, and simultaneously start the blocking control.
  • the preset callback information includes at least callback information corresponding to the request message, and an blocking control, configured to store callback information preset by the application unit and lock the user interface when the application unit sends the request message, and When receiving the response message of the request message returned by the server, the preset callback information corresponding to the request message is invoked for processing and the user interface is unlocked.
  • the single-threaded platform is configured to forward the request message sent by the application unit to a server, and forward the message returned by the server to the blocking control used by the application unit.
  • the embodiment of the invention further provides a system for communication between a terminal and a server, the system comprising a terminal and a server, the terminal comprising an blocking control, an application unit, a single-threaded platform and a user interface, wherein: the application unit is configured to block The control presets the callback information, sends a request message to the server, and starts the blocking control at the same time, the preset callback information includes at least the callback information corresponding to the clearing message; and the blocking control is configured to store the application unit to Setting the callback information and locking the user interface when the application unit sends the request message, and calling the preset callback information corresponding to the request message to be processed and released when receiving the response message of the request message returned by the server User interface is locked.
  • a single-threaded platform configured to forward the request message sent by the application unit to the server, and forward the message returned by the server to the blocking control used by the application unit;
  • the server is configured to process the request message sent by the application unit, and Return messages to a single-threaded platform.
  • the embodiment of the present invention is based on the message mechanism of the single-threaded platform itself, and only needs to set a blocking control on the application unit, so that the UI is locked before a certain request sent by the user is not returned, so that the terminal does not process the request on the keyboard, the screen, the touchpad, and the like.
  • Respond to achieve synchronization of messages on a single-threaded platform providing a convenient method for synchronous communication for applications such as C/S and B/S on wireless terminals of single-threaded platforms.
  • synchronous communication between the terminal and the server based on the Brew platform can be realized.
  • FIG. 1 is a flow chart of an embodiment of a method for communicating between a terminal and a server according to the present invention
  • FIG. 2 is a flow chart of a specific embodiment of a method for communicating a terminal and a server according to the present invention
  • FIG. 3 is a schematic structural diagram of a system for communicating between a terminal and a server according to the present invention.
  • the Brew platform uses a layering mechanism, including an AEE (Application Execute Environment) layer, an OEM (Original Equipment Manufacturer) layer, a driver, and a system service layer.
  • AEE Application Execute Environment
  • OEM OEM
  • a system service layer a layering mechanism
  • the embodiments of the present invention are mainly applied to the AEE layer.
  • Brew AEE is a green software interface layer that supports the Brew API (Application Programming Interface) and runtime environment.
  • AEE also manages application execution and responds in time. Users and some emergency events, such as incoming calls and text messages, for example, when an incoming call comes in, a running Brew app can immediately pause and resume work automatically after the call is completed.
  • the basic organizational unit of Brew AEE's environment is the module, which is the basic unit of Brew application development and deployment. It contains two elements in the module: application (Applet) and class (Class), where:
  • Application It is the basic execution unit of the Brew platform. Because Brew is single-threaded, no matter how many applications are in a module, only one application is activated at a time. One application can be launched by another application, but in this case, the current application is suspended and switched to another application. To illustrate the relationship between the application and the server, in the following, the application is represented by the terminal application.
  • Classes in AEE are the basic units that Brew can reuse, and the reuse scope of a class is not limited to the module it is in, but the entire AEE environment.
  • the access point of a class (that is, a set of APIs that perform a specific function) is called an Interface. All of Brew's APIs are organized in classes that provide interfaces for functions such as display, file operations, address book access, etc. At the same time, Brew allows application developers to write their own classes.
  • the Brew platform's API is asynchronous, and callbacks are one of the most ingenious ways to implement asynchronous methods. Therefore, the Brew platform often uses callbacks for asynchronous communication.
  • the callback can be implemented by a callback function.
  • the system or other function will automatically call a user-defined function, which is a callback. For example, using a callback to register an asynchronous message, the API requires the active object to log the callback before the service is requested. When the request is completed, the platform passes the returned callback method to the active object by calling the recorded callback method.
  • an blocking control is set to ensure that the UI (User Interface) is locked before the response message sent by the terminal application to the server is returned, and the keyboard and the screen are not responded.
  • the present invention provides an embodiment of a method for communicating between a terminal and a server. As shown in the flowchart of FIG. 1, the method in this embodiment includes:
  • Step 101 The terminal sends a request message to the server to lock the user interface.
  • Step 102 The terminal obtains a message returned by the server, and compares whether the identifier of the message is the same as the identifier of the request message, and if yes, processes the callback method corresponding to the preset request message. And unlock the user interface; otherwise, discard the message returned by the server.
  • the purpose of comparing whether the identifier of the message is the same as the identifier of the request message is: determining whether the message returned by the server is a response message of the sent request message.
  • Means for determining whether to receive a response message for a request message include, but are not limited to, an identification of the comparison message.
  • FIG. 2 it is a flowchart of a specific implementation manner of a method for communicating a terminal with a server.
  • the terminal application initiates a request to add a user record to the server because the service needs to be processed by the following steps:
  • Step 201 The terminal application registers the identifier of the request message with the blocking control.
  • the Brew platform message is divided into two types: system message and application message.
  • the message here refers to the application message.
  • the application message identifier can be the message name or the message number.
  • the specific rule can be customized by the user, for example, the terminal application adds a record message to the server.
  • the number is 10001, then 10001 is registered to the blocking control, registration can be achieved by calling the corresponding API function.
  • Step 202 The terminal application registers the callback method (ie, callback information) after returning the message from the server, and the timeout control callback method (ie, callback information) when the message is timed out without returning to the blocking control.
  • the callback method ie, callback information
  • the timeout control callback method ie, callback information
  • Step 203 The terminal application sends a request message to the server to add a user record, and starts the blocking control to wait for the return of the response message, and the blocking control will lock the UI and start timing.
  • the blocking control blocks all messages that are different from the identity of the sent request message, including keyboard response, screen processing, touchpad, soft keyboard, and dedicated keyboard.
  • the blocking control blocks only the UI-related messages, and does not block other system messages, such as alarm timing, network connection status change notifications, and so on.
  • the Brew platform will send the button message to the output system, such as screen display; but when the UI is locked, the user performs the same operation, although the Brew platform still The received button message is processed, but since the UI is locked at this time, the message displayed on the screen is blocked by the application, so the screen does not display the information input by the user.
  • Step 204 The request message is transmitted to the terminal communication module through the Brew AEE framework.
  • Step 205 The terminal communication module transmits a request message to the service server through the wireless network.
  • Step 206 The service server determines the operation by using the parameter of the identifier of the request message. Therefore, corresponding processing is performed. For example, when the message number is 10001, the server completes an operation of adding a user record, and sends the return message to the terminal communication module through the wireless network.
  • Step 207 The terminal communication module transmits a return message to the Brew AEE framework where the terminal is located.
  • Step 209 The blocking control used by the terminal application receives the return message. Because the UI is locked, only the blocking control is active at this time, so only the blocking control can receive the response.
  • Step 210 The blocking control determines whether the return message times out. If the preset time is exceeded, step 211 is performed; otherwise, step 212 is performed.
  • the timeout is a request failure, such as a connection timeout, the service is terminated, or the user chooses to re-initiate the request.
  • Step 211 The blocking control processes the return message according to the registered timeout control callback method, and unloads the blocking control to release the UI lock.
  • the terminal does not receive any message returned by the server when the preset time exceeds the preset time, it is also processed according to the registered timeout control callback method.
  • Step 212 The blocking control determines whether the identifier of the received message is the same as the identifier of the request message, such as the message number. If yes, step 213 is performed; if no, step 214 is performed. Since the identity of the request message has been previously registered to the blocking control, the identity of the returned message and the registered request message identifier can be directly compared.
  • Step 213 The blocking control processes the return message according to the registered request message callback method, and uninstalls the blocking control to release the UI lock.
  • the message callback method call returns the parameters in the message, decodes the parameter, and associates the sent message with a specific application to perform the corresponding service.
  • Step 214 The blocking control discards the message, that is, blocks all messages that are different from the identifier of the request message.
  • the blocking control may not discard the message, as long as the blocking control receives the response message of the request message at the terminal (or The user interface is unlocked when the preset time is exceeded, and the user interface is locked for the rest of the time.
  • the above steps implement the communication mode in which the terminal application continues to perform corresponding processing according to the result returned by the server after the request of the terminal is initiated, that is, the synchronization mode, thereby realizing the synchronous communication between the terminal and the server on the Brew platform.
  • the method in which the terminal application registers the request message with the blocking control, the callback method of the message, and the timeout control callback method in the step 201 to the step 202, that is, the request message and the callback method are pre-saved. Correspondence between the two.
  • the preset timeout control callback method in this embodiment is an alternative. Since the real-time performance of the network transmission is limited by the communication conditions, in this embodiment, in order to prevent the user from falling into an infinite loop and failing to respond to the system message in time and possibly causing a mandatory restart of the wireless terminal, the blocking control is set. A timer initializes a timeout control callback method and calls this callback method after the timer expires.
  • timeout control callback method such as whether the user chooses to wait or not, and performs the corresponding manual operation.
  • the timeout control callback method used in this embodiment can also be implemented by the system counting method.
  • the blocking control is uninstalled to unlock the UI and release system resources.
  • the process is the same as that in the foregoing embodiment, and only the correspondence between the request message identifier and the message callback method is preset, and then sent to the server.
  • Requesting a message, simultaneously locking the UI the server completes the operation of deleting/modifying a record, and the blocking control compares the return message with the identifier of the request message. If the same, the method is processed according to the callback method corresponding to the preset request message, and the UI lock is released. ; Otherwise, the return message is discarded.
  • the timeout control callback method can also be preset. If the response message is not received after the timeout, the preset timeout control callback method is called, and the UI lock is released.
  • the embodiment of the invention provides a system for communication between a terminal and a server.
  • the system provides an blocking control on the existing Brew platform for the asynchronous communication mode of the terminal application, and the message sent by the blocking application in the terminal application is not returned.
  • the UI is always locked before the corresponding response, and after the server returns a response, the processing of the service is continued, thereby converting the asynchronous communication mode of the terminal application into the synchronous communication mode.
  • the system includes: an application unit 301, a blocking control 302, a Brew platform 303, and a server 400 inside the wireless terminal 300, wherein:
  • the application unit 301 is configured to preset a callback method corresponding to the request message to the blocking control 302.
  • the blocking control 302 is started to lock the UI, where the callback method corresponding to the preset request message can be identified by the registration request message. And the callback method corresponding to the request message is implemented.
  • the blocking control 302 is configured to receive and save the corresponding message corresponding to the request message preset by the application unit 301.
  • the method such as saving the identifier of the request message and the corresponding callback method, and receiving the return message forwarded by the Brew platform 303, comparing whether the identifier of the returned message is the same as the identifier of the request message, and if so, the call has been
  • the callback method corresponding to the registered request message is processed, and the blocking control is uninstalled to release the UI lock;
  • the Brew platform 303 is configured to forward the request message sent by the application unit 301 to the server 400, and send the response message returned by the server 400 to the blocking control 302 used by the application unit 301.
  • the server 400 is configured to receive the sending by the application unit 301. The request message is processed accordingly and a response message is sent back.
  • a timer is set in the blocking control 302, and is initialized by the application unit 301. Registering the timeout control callback method with the blocking control 302, and simultaneously starting the blocking control 302, and then, when the timer exceeds the preset time, if the response message of the request message has not been received, the blocking control 302 is called. The registered timeout controls the callback method and unloads the blocking control to unlock the UI.
  • the Brew platform sends a request message to the terminal communication module, and the terminal communication module transmits the message to the server through the wireless network, and the message returned by the server is first transmitted to the terminal communication module through the wireless network, and is sent by the terminal communication module to the terminal.
  • Brew platform sends a request message to the terminal communication module, and the terminal communication module transmits the message to the server through the wireless network, and the message returned by the server is first transmitted to the terminal communication module through the wireless network, and is sent by the terminal communication module to the terminal.
  • the embodiment of the present invention further provides a device for communicating between a terminal and a server through a single-thread platform, that is, an blocking control 302, as shown in FIG. 3, to convert the asynchronous communication mode of the terminal application into a synchronous communication mode.
  • the blocking control 302 includes a storage unit 3021, a comparison unit 3022, and an execution unit 3023, where:
  • the storage unit 3021 is configured to save a callback method corresponding to the request message sent by the application unit 301, such as saving the identifier of the clear request message and a callback method corresponding to the message (ie, callback information); and comparing unit 3022,
  • the message returned by the server 400 forwarded by the Brew platform 303 is compared with the identifier of the request message sent by the application unit 301, and the comparison result is sent to the execution unit 3023; since the request message sent by the application unit 301 has been saved in the storage unit 3021.
  • the identifier so the identifier of the return message can be directly compared with the identifier of the request message held in the storage unit 3021.
  • the executing unit 3023 is configured to lock the UI, and invoke the phase according to the result sent by the comparing unit 3022. The method should be processed. If the return message is the same as the request message identifier sent by the application unit 301, the callback method corresponding to the request message saved in the storage unit 3021 is called for processing, and the blocking control is uninstalled to release the UI lock.
  • the device may further include a timing unit 3024.
  • the storage unit 3021 is further configured to store a timeout control callback method registered by the application unit 301.
  • the timing unit 3024 is configured to start timing when the UI is locked.
  • the execution unit 3023 is notified when the timeout occurs; the execution unit 3023 is configured to call the timeout control callback method registered in the storage unit 3021 to process when the notification of the timing unit 3024 is received and the same comparison result of the identification of the comparison unit is not received, And uninstall the blocking control to unlock the UI.
  • the callback information preset by the application unit 301 to the blocking control 302 may include at least the callback information corresponding to the request message, and may also include a timeout control.
  • the callback information is further included, and the information stored by the storage unit 3021 includes callback information corresponding to the request message preset by the application unit 3023, and may further include timeout control callback information.
  • the execution unit 3023 can also be considered to include two execution units, the first execution unit and the second execution unit, wherein the first execution unit locks the user interface when the application unit 301 sends the request message, and informs the comparison unit 3022.
  • the comparison result is the same, the callback information corresponding to the request message stored in the storage unit 3021 is called for processing, and the user interface is unlocked.
  • the second execution unit is configured to, when receiving the preset time notification of the timing unit 3024 and the comparison unit 3022 does not obtain the same comparison result, call the timeout control callback information stored by the storage unit 3021 for processing, and release the user interface lock.
  • the related processing of the timeout control callback information may not be performed, that is, the application unit 301 does not need to preset the timeout control callback information to the blocking control 302, and thus the blocking control 302 does not need to set the second execution unit.
  • the timing unit 3024 does not need to exist.
  • the comparison unit 3022 compares whether the request message identifier and the server return message identifier are the same in the purpose of: determining whether the server return message is a response message of the sent request message, and if the identifiers are the same, the server returns that the message is The response message of the sent request message, if the identifier is different, indicates that the server returns a message that is not a response message of the sent request message. Therefore, the comparison identifier is only one specific embodiment for determining whether the terminal receives the response of the request message, and any functional unit that can determine whether the server return message is a response message of the sent request message can replace the comparison unit 3022.
  • Such functional units are collectively referred to as a determining unit for determining whether the server returns a message as a response message to the transmitted request message. Further, if the system is relatively stable, and the second execution unit is not required to be set in the terminal, the basic function of blocking the user interface performed by the determining unit and the first execution unit is to lock the user interface when the terminal sends the request message. And when the terminal receives the response message of the request message returned by the server, calling the callback information corresponding to the request message stored in the storage unit to process and unlock the user interface. Thereby, the determining unit and the first executing unit can be merged together, which is called a blocking processing unit.
  • the UI is locked when the terminal sends the request message, and only when the terminal receives the response message of the request message, the terminal can process and release the UI lock according to the preset callback information; Keeping the UI locked, so that the terminal does not respond to processing requests such as keyboard, screen, touchpad, etc., thereby realizing synchronization of messages on a single-threaded platform, and developing applications such as C/S and B/S on a wireless terminal of a single-threaded platform.
  • the UI is locked when the terminal sends the request message, and only when the terminal receives the response message of the request message, the terminal can process and release the UI lock according to the preset callback information; Keeping the UI locked, so that the terminal does not respond to processing requests such as keyboard, screen, touchpad, etc., thereby realizing synchronization of messages on a single-threaded platform, and developing applications such as C/S and B/S on a wireless terminal of a single-threaded platform.
  • a method of timeout control is adopted, so that the terminal does not receive
  • the preset timeout control callback information may be directly called for processing and the UI lock is cancelled; otherwise, if the preset time is not exceeded and the terminal does not receive the response message of the request message, Then, the UI is locked, so that the terminal does not respond to the processing request of the keyboard, the screen, the touchpad, etc., thereby realizing the synchronization of the messages on the single-threaded platform, and providing the user with a more friendly human-computer interaction interface.

Landscapes

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

Abstract

A method for communication between a terminal and a server in a single thread platform system includes: the terminal sends a request message to the server and locks the user interface; upon receiving the returned response message for said request message from the server, the terminal performs the process according to the preset callback method corresponding to said request message and unlocks the user interface. There are still an apparatus for communication between a terminal and a server by a single thread platform, a terminal, and a system for communication betwwen a terminal and a server. The asynchronous communication on a single threadplatform can be converted into a synchronous communication by the present invention.

Description

终端与服务器通信的方法、 系统和装置  Method, system and device for communication between terminal and server
本申请要求于 2006 年 8 月 28 日提交中国专利局、 申请号为 200610111967.2、 发明名称为"终端与服务器通信的方法、 系统和装置"的中国 专利申请的优先权, 其全部内容通过引用结合在本申请中。  This application claims priority to Chinese Patent Application No. 200610111967.2, entitled "Methods, Systems and Apparatus for Terminal and Server Communication", filed on August 28, 2006, the entire contents of In this application.
技术领域 Technical field
本发明属于通信技术领域, 尤其涉及终端与服务器通信的方法、 系统和装 置。  The present invention belongs to the field of communication technologies, and in particular, to a method, system and apparatus for communication between a terminal and a server.
背景技术 Background technique
对于仅支持单线程的业务平台,通常应用之间以及应用与下层平台之间的 通信是异步 , Brew ( Binary Runtime Environment for Wireless, 无线二进希1 J 运行环境)平台就是这样一种平台。但是在实现本发明的过程中,发明人发现, 随着技术的发展, 有将异步通信转变为同步通信的必要。 下面以 Brew平台为 例进行详细说明。 Support only single-threaded service platform, generally communication between applications and underlying application platform is asynchronous, Brew (Binary Runtime Environment for Wireless , the wireless binary runtime environment Xi 1 J) is one such platform internet. However, in the process of implementing the present invention, the inventors have found that with the development of technology, there is a need to convert asynchronous communication into synchronous communication. The following is a detailed description of the Brew platform.
Brew平台是为提供增值业务所开发运行的基本平台。 在无线终端内部, 基于 Brew平台的应用 (Applet )与其它应用或下层平台之间的通信都是异步 的, 即发送方发出数据后, 无须等接收方发回响应, 接着发送下一个数据包。 这种方式适合于不需要服务器的单机应用, 然而, 未来通信网将以数据业务为 中心, 并普遍使用互联网 IP ( Internet Protocol , 网际协议) , 整个网络将以 IP 协议作为统一的通信协议 , 即所谓的 Everything Over IP (一切基于网际协议), 此时网络只起信息传输的作用, 所有的增值业务都在网络之外由终端完成, 因 此, 终端应用程序将日趋复杂, 需要业务服务器提供支持, 如 IMS ( IP Multi-media Sub-system , 网际协议多媒体子系统)网络中各种应用基本都需要 AS ( Application Server, 应用服务器), 为了适应这一技术发展趋势, Brew无 线终端也需要支持 C/S ( Client/Server, 客户端 /服务器)、 B/S(Browser/Server, 浏览器 /月 务器)应用。  The Brew platform is the basic platform for developing and running value-added services. Inside the wireless terminal, the communication between the Brew platform-based application (Applet) and other applications or the underlying platform is asynchronous, that is, after the sender sends the data, the sender does not need to wait for the response to be sent back, and then sends the next packet. This method is suitable for stand-alone applications that do not require a server. However, the future communication network will be centered on data services and generally use Internet IP (Internet Protocol). The entire network will use the IP protocol as a unified communication protocol. The so-called Everything Over IP (all based on Internet Protocol), the network only plays the role of information transmission, all value-added services are completed by the terminal outside the network, therefore, the terminal application will become more and more complex, requiring the support of the business server. For example, an application (application server) is required for various applications in the IMS (IP Multi-media Sub-system) network. In order to adapt to this technology trend, the Brew wireless terminal also needs to support C/. S (Client/Server, Client/Server), B/S (Browser/Server, Browser/Server) application.
但是, 对于复杂的 C/S、 B/S应用, 往往存在用户操作序列的限制, 即某 个操作服务器返回结果之前, 不能进行下个操作, 因此, 需要将基于 Brew平 台的终端应用与服务器的通信转化为同步方式。 简单举例说明: 终端应用 A 需要完成删除一条服务器记录的功能(简称 Funcl ), 若服务器成功删除该记 录, 则终端应用 A继续完成其它某功能(简称 Func2 ); 若服务器删除该记录 失败, 则终端应用 A完成其它某功能(筒称 Func3 )。 由于 Brew平台都是异 步通信, 上面的需求要求根据服务器对 Funcl 不同的处理结果进行不同的处 理, 即成功继续 Func2, 失败继续 Func3, 因此, 终端应用必须接收到服务器 发回的响应后才能进行处理, 终端应用必须对 Funcl进行同步转换控制, 即终 端应用 A必须等服务器对 Funcl的处理结果返回后, 才可以继续其它操作。 However, for complex C/S and B/S applications, there is often a limitation of the user operation sequence, that is, an operation server cannot perform the next operation before returning the result. Therefore, it is necessary to apply the terminal application based on the Brew platform to the server. Communication is converted to a synchronous mode. A simple example: Terminal application A needs to complete the function of deleting a server record (Funcl), if the server successfully deletes the record Record, the terminal application A continues to complete some other function (referred to as Func2); if the server fails to delete the record, the terminal application A completes some other function (called Func3). Since the Brew platform is asynchronous communication, the above requirements require different processing according to different processing results of the server, that is, the Func2 is successfully continued, and the Func3 is failed. Therefore, the terminal application must receive the response sent by the server before processing. The terminal application must perform synchronous conversion control on Funcl, that is, the terminal application A must wait for the server to return the processing result of Funcl before continuing other operations.
而在现有技术中, 还没有在 Brew这类单线程平台上实现异步转同步控制 的方案。  In the prior art, there is no solution for implementing asynchronous to synchronous control on a single-threaded platform such as Brew.
发明内容 Summary of the invention
本发明实施例提供了终端与服务器通信的方法、 系统和装置, 能够将单线 程平台上的异步通信转变为同步通信。  Embodiments of the present invention provide a method, system, and apparatus for communication between a terminal and a server, which can convert asynchronous communication on a single-thread platform into synchronous communication.
本发明实施例提供了一种终端与服务器通信的方法,用于单线程平台的系 统, 所述方法包括: 终端向服务器发送奇求消息并锁定用户接口; 终端在收到 所述服务器返回的所述请求消息的响应消息时 ,按照预置的所述请求消息对应 的回调方法处理并解除用户接口锁定。  An embodiment of the present invention provides a method for a terminal to communicate with a server, which is used in a system for a single-threaded platform. The method includes: the terminal sends a strange request message to the server and locks the user interface; and the terminal receives the return from the server. When the response message of the request message is described, the user interface lock is processed and released according to the preset callback method corresponding to the request message.
本发明实施例还提供了一种用于终端与服务器通过单线程平台通信的装 置, 所述装置包括: 存储单元, 用于存储回调信息, 所述回调信息至少包括终 端发送的请求消息所对应的回调信息; 阻塞处理单元, 用于在终端发送请求消 息时锁定用户接口, 并在终端收到服务器返回的所述请求消息的响应消息时, 调用所述存储单元中存储的所述请求消息对应的回调信息进行处理并解除所 述用户接口锁定。  The embodiment of the present invention further provides an apparatus for a terminal and a server to communicate through a single-threaded platform, where the apparatus includes: a storage unit, configured to store callback information, where the callback information includes at least a request message sent by the terminal. a callback processing unit, configured to: when the terminal sends the request message, lock the user interface, and when the terminal receives the response message of the request message returned by the server, invoke the corresponding request message stored in the storage unit The callback information is processed and the user interface is unlocked.
本发明实施例还提供了一种终端, 包括应用单元、单线程平台以及用户接 口, 还包括阻塞控件, 其中: 应用单元, 用于向阻塞控件预置回调信息, 发送 请求消息并同时启动阻塞控件,所述预置的回调信息至少包括所述请求消息所 对应的回调信息; 阻塞控件, 用于存储应用单元向其预置的回调信息并在所述 应用单元发送请求消息时锁定用户接口,以及在收到服务器返回的所述清求消 息的响应消息时,调用预置的所述请求消息对应的回调信息进行处理并解除所 述用户接口锁定。单线程平台, 用于将所述应用单元发送的所述请求消息转发 到服务器, 并将服务器返回的消息转发到所述应用单元所使用的阻塞控件。 本发明实施例还提供了一种终端与服务器通信的系统,所述系统包括终端 和服务器, 所述终端包括阻塞控件、应用单元、单线程平台及用户接口,其中: 应用单元, 用于向阻塞控件预置回调信息, 向服务器发送请求消息并同时启动 阻塞控件, 所述预置的回调信息至少包括所述清求消息所对应的回调信息; 阻 塞控件,用于存储所述应用单元向其预置的回调信息并在所述应用单元发送请 求消息时锁定用户接口 ,以及在收到所述服务器返回的所述请求消息的响应消 息时调用预置的所述请求消息对应的回调信息处理并解除用户接口锁定。单线 程平台,用于将所述应用单元发送的请求消息转发到服务器, 并将服务器返回 的消息转发到所述应用单元所使用的阻塞控件; 服务器, 用于处理应用单元发 出的请求消息, 并返回消息到单线程平台。 The embodiment of the present invention further provides a terminal, including an application unit, a single-thread platform, and a user interface, and further includes an blocking control, where: an application unit, configured to preset callback information to the blocking control, send a request message, and simultaneously start the blocking control. The preset callback information includes at least callback information corresponding to the request message, and an blocking control, configured to store callback information preset by the application unit and lock the user interface when the application unit sends the request message, and When receiving the response message of the request message returned by the server, the preset callback information corresponding to the request message is invoked for processing and the user interface is unlocked. The single-threaded platform is configured to forward the request message sent by the application unit to a server, and forward the message returned by the server to the blocking control used by the application unit. The embodiment of the invention further provides a system for communication between a terminal and a server, the system comprising a terminal and a server, the terminal comprising an blocking control, an application unit, a single-threaded platform and a user interface, wherein: the application unit is configured to block The control presets the callback information, sends a request message to the server, and starts the blocking control at the same time, the preset callback information includes at least the callback information corresponding to the clearing message; and the blocking control is configured to store the application unit to Setting the callback information and locking the user interface when the application unit sends the request message, and calling the preset callback information corresponding to the request message to be processed and released when receiving the response message of the request message returned by the server User interface is locked. a single-threaded platform, configured to forward the request message sent by the application unit to the server, and forward the message returned by the server to the blocking control used by the application unit; the server is configured to process the request message sent by the application unit, and Return messages to a single-threaded platform.
本发明实施例基于单线程平台本身的消息机制,仅需要对应用单元设置一 个阻塞控件, 使得用户已发送的某个请求没有返回前, UI锁定, 使得终端不 对键盘、屏幕、触摸板等处理请求做出响应, 从而实现单线程平台上消息的同 步, 为在单线程平台的无线终端上开发 C/S、 B/S这类应用提供了便捷的同步 通信的方法。 当本发明实施例应用于 Brew平台时, 就可以实现基于 Brew平 台的终端与服务器的同步通信。  The embodiment of the present invention is based on the message mechanism of the single-threaded platform itself, and only needs to set a blocking control on the application unit, so that the UI is locked before a certain request sent by the user is not returned, so that the terminal does not process the request on the keyboard, the screen, the touchpad, and the like. Respond to achieve synchronization of messages on a single-threaded platform, providing a convenient method for synchronous communication for applications such as C/S and B/S on wireless terminals of single-threaded platforms. When the embodiment of the present invention is applied to the Brew platform, synchronous communication between the terminal and the server based on the Brew platform can be realized.
附图说明 DRAWINGS
图 1为本发明终端与服务器通信的方法实施例流程图;  1 is a flow chart of an embodiment of a method for communicating between a terminal and a server according to the present invention;
图 2为本发明终端与服务器通信方法实施例的一具体实施方式流程图; 图 3为本发明终端与服务器通信的系统实施例结构示意图。  2 is a flow chart of a specific embodiment of a method for communicating a terminal and a server according to the present invention; and FIG. 3 is a schematic structural diagram of a system for communicating between a terminal and a server according to the present invention.
具体实施方式 detailed description
为了更好地理解本发明实施例, 以下以 Brew平台为例, 结合附图进行描 述。  In order to better understand the embodiments of the present invention, the Brew platform is taken as an example and described with reference to the accompanying drawings.
首先说明一下现有 Brew平台的消息机制。  First, let's explain the message mechanism of the existing Brew platform.
Brew平台釆用分层机制 , 包括 AEE ( Application Execute Environment, 应用执行环境 )层、 OEM ( Original Equipment Manufacturer,原始设备制造商) 层、驱动及系统服务层, 本发明实施例主要应用于 AEE层。 Brew AEE是一个 青巧的软件接口层, 用来支持 Brew API ( Application Programming Interface , 应用编程接口)和运行环境; 同时 AEE也管理着应用程序的执行, 及时响应 用户和一些紧急事件, 如来电和短信呼入, 例如, 当有来电呼入时, 一个正在 运行的 Brew应用可以立即暂停, 并在通话完毕后, 再自动恢复工作。 The Brew platform uses a layering mechanism, including an AEE (Application Execute Environment) layer, an OEM (Original Equipment Manufacturer) layer, a driver, and a system service layer. The embodiments of the present invention are mainly applied to the AEE layer. Brew AEE is a green software interface layer that supports the Brew API (Application Programming Interface) and runtime environment. At the same time, AEE also manages application execution and responds in time. Users and some emergency events, such as incoming calls and text messages, for example, when an incoming call comes in, a running Brew app can immediately pause and resume work automatically after the call is completed.
Brew AEE的环境基本组织单位是模块 (Module), 模块是 Brew应用开发 和部署的基本单位, 在模块中包含两种元素: 应用 (Applet )和类 (Class ), 其中:  The basic organizational unit of Brew AEE's environment is the module, which is the basic unit of Brew application development and deployment. It contains two elements in the module: application (Applet) and class (Class), where:
应用: 是 Brew平台的基本执行单位, 因为 Brew是单线程的, 所以, 不 论一个模块里面有多少个应用, 同一时间只有一个应用被激活。一个应用可以 被另一个应用启动,但在这种情况下, 当前的应用被暂停,切换到另一个应用。 为了说明应用与服务器的关系, 在下文中, 用终端应用表示应用。  Application: It is the basic execution unit of the Brew platform. Because Brew is single-threaded, no matter how many applications are in a module, only one application is activated at a time. One application can be launched by another application, but in this case, the current application is suspended and switched to another application. To illustrate the relationship between the application and the server, in the following, the application is represented by the terminal application.
类: AEE中的类是 Brew可以复用的基本单位, 而且类的复用范围并不局 限于其所在的模块, 而是整个 AEE环境。 类的访问点 (即一组完成特定功能 的 API )被称为接口 ( Interface )。 Brew所有的 API都以类的形式来组织, 提 供了包括显示、 文件操作、 地址簿访问等功能的接口; 同时, Brew容许应用 开发者编写自己的类。  Classes: Classes in AEE are the basic units that Brew can reuse, and the reuse scope of a class is not limited to the module it is in, but the entire AEE environment. The access point of a class (that is, a set of APIs that perform a specific function) is called an Interface. All of Brew's APIs are organized in classes that provide interfaces for functions such as display, file operations, address book access, etc. At the same time, Brew allows application developers to write their own classes.
Brew平台的 API是异步的,而回调是实现异步方式的一个最筒捷的途径, 因此, Brew平台常常采用回调的方法进行异步通信。 回调可通过回调函数来 实现, 当发生某种事件时, 系统或其它函数将会自动调用用户预先定义的一段 函数, 这个过程即是回调。 例如, 使用回调来实现异步消息的注册, API要求 主动对象在服务被请求之前记录回调, 当请求完成后,该平台就通过调用记录 过的回调方法将返回值传递到主动对象中。  The Brew platform's API is asynchronous, and callbacks are one of the most ingenious ways to implement asynchronous methods. Therefore, the Brew platform often uses callbacks for asynchronous communication. The callback can be implemented by a callback function. When an event occurs, the system or other function will automatically call a user-defined function, which is a callback. For example, using a callback to register an asynchronous message, the API requires the active object to log the callback before the service is requested. When the request is completed, the platform passes the returned callback method to the active object by calling the recorded callback method.
在本发明实施例中,基于 Brew平台现有的消息机制 ,设置一个阻塞控件, 确保在终端应用向服务器发送的响应消息没有返回前, UI ( User Interface, 用 户接口)锁定, 不响应键盘、 屏幕、 触摸板等的处理, 从而达到请求异步模拟 转换为同步的效果。  In the embodiment of the present invention, based on the existing message mechanism of the Brew platform, an blocking control is set to ensure that the UI (User Interface) is locked before the response message sent by the terminal application to the server is returned, and the keyboard and the screen are not responded. The processing of the touchpad, etc., thereby achieving the effect of requesting asynchronous analog conversion to synchronization.
首先,本发明提供了一种终端与服务器通信的方法实施例, 如图 1所示的 流程图 , 本实施例的方法包括:  First, the present invention provides an embodiment of a method for communicating between a terminal and a server. As shown in the flowchart of FIG. 1, the method in this embodiment includes:
步骤 101 : 终端向服务器发送请求消息, 锁定用户接口;  Step 101: The terminal sends a request message to the server to lock the user interface.
步驟 102: 终端获取服务器返回的消息, 比较该消息的标识与所述请求消 息的标识是否相同,如果是,则按照预置的所述请求消息对应的回调方法处理, 并解除用户接口锁定; 否则, 丢弃服务器返回的消息。 需要说明, 在终端获取 服务器返回的消息后,比较该消息的标识与所述请求消息的标识是否相同的目 的在于: 确定服务器返回的消息是否为已发送的请求消息的响应消息。确定是 否收到请求消息的响应消息的手段包括但不限于比较消息的标识。 Step 102: The terminal obtains a message returned by the server, and compares whether the identifier of the message is the same as the identifier of the request message, and if yes, processes the callback method corresponding to the preset request message. And unlock the user interface; otherwise, discard the message returned by the server. It should be noted that after the terminal obtains the message returned by the server, the purpose of comparing whether the identifier of the message is the same as the identifier of the request message is: determining whether the message returned by the server is a response message of the sent request message. Means for determining whether to receive a response message for a request message include, but are not limited to, an identification of the comparison message.
举例说明本发明实施例的具体实现方法, 参照图 2, 其为本发明终端与服 务器通信的方法实施例的一具体实施方式流程图。  A specific implementation method of an embodiment of the present invention is described. Referring to FIG. 2, it is a flowchart of a specific implementation manner of a method for communicating a terminal with a server.
例如, 终端应用因为业务需要发起对服务器增加一条用户记录的请求, 采 用如下步骤处理:  For example, the terminal application initiates a request to add a user record to the server because the service needs to be processed by the following steps:
步骤 201: 终端应用向阻塞控件注册请求消息的标识。 Brew平台消息分 为系统消息和应用消息两类,这里的消息指应用消息,应用消息标识可为消息 名称或消息号,具体规则可由用户自定义,如终端应用向服务器发起的增加一 条记录的消息号为 10001 , 则将 10001注册到阻塞控件, 注册可以通过调用相 应的 API函数来实现。  Step 201: The terminal application registers the identifier of the request message with the blocking control. The Brew platform message is divided into two types: system message and application message. The message here refers to the application message. The application message identifier can be the message name or the message number. The specific rule can be customized by the user, for example, the terminal application adds a record message to the server. The number is 10001, then 10001 is registered to the blocking control, registration can be achieved by calling the corresponding API function.
步骤 202: 终端应用将该消息从服务器返回后的回调方法(即回调信息) 以及消息超时而未返回情况下的超时控制回调方法(即回调信息)注册到阻塞 控件。  Step 202: The terminal application registers the callback method (ie, callback information) after returning the message from the server, and the timeout control callback method (ie, callback information) when the message is timed out without returning to the blocking control.
步骤 203: 终端应用向服务器发出增加一条用户记录的请求消息, 并启动 阻塞控件等待响应消息的返回, 阻塞控件将锁定 UI并开始计时。 UI锁定后, 阻塞控件将阻塞与已发送的请求消息的标识不同的所有消息, 包括键盘响应、 屏幕处理、 触摸板、 软键盘和专用键盘等。 不过, UI锁定后阻塞控件阻塞的 只是与 UI有关的消息, 对于其它的系统消息不作阻塞, 例如闹钟定时、 网络 连接状态变化通知等。 举例说明, UI锁定前, 当用户通过键盘输入某个字符 时, Brew平台会将按键消息发送到输出系统, 如进行屏幕显示; 但是当 UI 锁定后, 用户进行同样的操作时, 虽然 Brew平台仍会对接收到的按键消息进 行处理, 但是由于此时 UI锁定, 进行屏幕显示的消息被应用阻塞, 所以屏幕 不会显示用户所输入的信息。  Step 203: The terminal application sends a request message to the server to add a user record, and starts the blocking control to wait for the return of the response message, and the blocking control will lock the UI and start timing. When the UI is locked, the blocking control blocks all messages that are different from the identity of the sent request message, including keyboard response, screen processing, touchpad, soft keyboard, and dedicated keyboard. However, after the UI locks, the blocking control blocks only the UI-related messages, and does not block other system messages, such as alarm timing, network connection status change notifications, and so on. For example, before the UI is locked, when the user inputs a character through the keyboard, the Brew platform will send the button message to the output system, such as screen display; but when the UI is locked, the user performs the same operation, although the Brew platform still The received button message is processed, but since the UI is locked at this time, the message displayed on the screen is blocked by the application, so the screen does not display the information input by the user.
步骤 204: 请求消息通过 Brew AEE框架向终端通信模块传送。  Step 204: The request message is transmitted to the terminal communication module through the Brew AEE framework.
步骤 205: 终端通信模块通过无线网络向业务服务器传送请求消息。  Step 205: The terminal communication module transmits a request message to the service server through the wireless network.
步骤 206: 业务服务器通过该请求消息的标识符的参数可判断是何种操作 从而进行相应的处理, 比如, 消息号为 10001时, 服务器完成增加一条用户记 录的操作, 并将返回消息通过无线网络发送到终端通信模块。 Step 206: The service server determines the operation by using the parameter of the identifier of the request message. Therefore, corresponding processing is performed. For example, when the message number is 10001, the server completes an operation of adding a user record, and sends the return message to the terminal communication module through the wireless network.
步驟 207: 终端通信模块将返回消息传送到终端所在的 Brew AEE框架。 步骤 208: Brew AEE框架向终端应用发送返回消息。  Step 207: The terminal communication module transmits a return message to the Brew AEE framework where the terminal is located. Step 208: The Brew AEE framework sends a return message to the terminal application.
步骤 209: 终端应用所使用的阻塞控件接收到返回消息。 由于 UI锁定, 此时只有阻塞控件处于活动状态, 因此只有阻塞控件可以接收处理该响应。  Step 209: The blocking control used by the terminal application receives the return message. Because the UI is locked, only the blocking control is active at this time, so only the blocking control can receive the response.
步骤 210: 阻塞控件判断返回消息是否超时, 如果超过预置时间, 则执行 步骤 211 ; 否则, 执行步骤 212。 超时即请求失败, 比如连接超时, 该服务终 止, 或由用户选择重新发起请求。  Step 210: The blocking control determines whether the return message times out. If the preset time is exceeded, step 211 is performed; otherwise, step 212 is performed. The timeout is a request failure, such as a connection timeout, the service is terminated, or the user chooses to re-initiate the request.
步骤 211: 阻塞控件按照已注册的超时控制回调方法处理返回消息, 并卸 载阻塞控件以解除 UI锁定。 此外, 需要说明的是, 如果终端超过预置时间时 没有收到服务器返回的任何消息, 则也按照已注册的超时控制回调方法处理。  Step 211: The blocking control processes the return message according to the registered timeout control callback method, and unloads the blocking control to release the UI lock. In addition, it should be noted that if the terminal does not receive any message returned by the server when the preset time exceeds the preset time, it is also processed according to the registered timeout control callback method.
步骤 212: 阻塞控件判断接收到的消息的标识与已所述请求消息的标识如 消息号是否相同, 如果是, 则执行步骤 213; 如果否, 执行步骤 214。 由于已 预先将请求消息的标识注册到阻塞控件,故可直接比较返回消息的标识与已注 册的请求消息标识。  Step 212: The blocking control determines whether the identifier of the received message is the same as the identifier of the request message, such as the message number. If yes, step 213 is performed; if no, step 214 is performed. Since the identity of the request message has been previously registered to the blocking control, the identity of the returned message and the registered request message identifier can be directly compared.
步骤 213: 阻塞控件按照注册的请求消息回调方法处理返回消息, 并卸载 阻塞控件以解除 UI锁定。 消息返回后, 消息回调方法调用返回消息中的参数, 对参数进行解码, 通过该参数使所发送的消息与一个具体的应用程序关联起 来, 执行相应业务。  Step 213: The blocking control processes the return message according to the registered request message callback method, and uninstalls the blocking control to release the UI lock. After the message is returned, the message callback method call returns the parameters in the message, decodes the parameter, and associates the sent message with a specific application to perform the corresponding service.
步骤 214: 阻塞控件丢弃该消息, 即阻塞所有与请求消息的标识不相同的 消息, 当然, 阻塞控件也可以不对该消息进行丟弃操作, 只要阻塞控件在终端 收到请求消息的响应消息(或者超过预置时间)时才解除用户接口锁定, 其余 时间内保持用户接口锁定即可。  Step 214: The blocking control discards the message, that is, blocks all messages that are different from the identifier of the request message. Of course, the blocking control may not discard the message, as long as the blocking control receives the response message of the request message at the terminal (or The user interface is unlocked when the preset time is exceeded, and the user interface is locked for the rest of the time.
以上步骤实现了终端应用在发起对服务器的请求后,终端应用根据服务器 返回结果继续进行相应处理的通信方式, 即同步方式, 从而实现了在 Brew平 台上终端与服务器的同步通信。  The above steps implement the communication mode in which the terminal application continues to perform corresponding processing according to the result returned by the server after the request of the terminal is initiated, that is, the synchronization mode, thereby realizing the synchronous communication between the terminal and the server on the Brew platform.
其中, 步聚 201〜步骤 202中终端应用向阻塞控件注册请求消息的标识、 该消息的回调方法及超时控制回调方法,也即预先保存请求消息与回调方法之 间的对应关系。 The method in which the terminal application registers the request message with the blocking control, the callback method of the message, and the timeout control callback method in the step 201 to the step 202, that is, the request message and the callback method are pre-saved. Correspondence between the two.
需要说明的是,本实施例中的预置超时控制回调方法是一个可选方案。 由 于网络传输的实时性受到通信条件的限制, 因此在本实施例中, 为了防止用户 陷入无限循环而无法及时响应系统消息及可能导致的无线终端的强制性重新 启动,特在阻塞控件中设置了一个定时器,并初始化了一个超时控制回调方法, 在定时器结束后调用这个回调方法。  It should be noted that the preset timeout control callback method in this embodiment is an alternative. Since the real-time performance of the network transmission is limited by the communication conditions, in this embodiment, in order to prevent the user from falling into an infinite loop and failing to respond to the system message in time and possibly causing a mandatory restart of the wireless terminal, the blocking control is set. A timer initializes a timeout control callback method and calls this callback method after the timer expires.
当然, 也可以不设置超时控制回调方法, 比如由用户选择是否等待, 进行 相对应的手动操作。本实施例中所采用的超时控制回调方法也可以由系统计数 的方法实现。  Of course, you can also set the timeout control callback method, such as whether the user chooses to wait or not, and performs the corresponding manual operation. The timeout control callback method used in this embodiment can also be implemented by the system counting method.
不论是注册的请求消息回调方法,还是超时控制回调方法, 均要卸载所述 的阻塞控件, 以解除对 UI的锁定并释放系统资源。  Whether it is a registered request message callback method or a timeout control callback method, the blocking control is uninstalled to unlock the UI and release system resources.
当终端应用因为业务需要发起对业务服务器删除 /修改一条记录的请求 时, 与上述实施例中处理流程相同,只需预置请求消息标识与该消息回调方法 之间的对应关系, 然后向服务器发送请求消息, 同时锁定 UI, 服务器完成删 除 /修改一条记录的操作, 阻塞控件比较返回消息与所述请求消息的标识, 如 果相同, 则按照预置的请求消息对应的回调方法处理, 并解除 UI锁定; 否则, 丢弃返回消息。 还可预置超时控制回调方法, 若超时未收到响应消息, 则调用 预置的超时控制回调方法处理, 并解除 UI锁定。  When the terminal application initiates a request to delete/modify a record for the service server, the process is the same as that in the foregoing embodiment, and only the correspondence between the request message identifier and the message callback method is preset, and then sent to the server. Requesting a message, simultaneously locking the UI, the server completes the operation of deleting/modifying a record, and the blocking control compares the return message with the identifier of the request message. If the same, the method is processed according to the callback method corresponding to the preset request message, and the UI lock is released. ; Otherwise, the return message is discarded. The timeout control callback method can also be preset. If the response message is not received after the timeout, the preset timeout control callback method is called, and the UI lock is released.
本发明实施例提供了一种终端与服务器通信的系统, 该系统在现有 Brew 平台上, 针对终端应用的异步通信方式, 提供了一个阻塞控件, 该阻塞控件在 终端应用所发送的消息未返回对应的响应前始终锁定 UI, 在服务器返回响应 后, 继续进行业务的处理,从而将终端应用的异步通信方式转变为同步通信方 式。  The embodiment of the invention provides a system for communication between a terminal and a server. The system provides an blocking control on the existing Brew platform for the asynchronous communication mode of the terminal application, and the message sent by the blocking application in the terminal application is not returned. The UI is always locked before the corresponding response, and after the server returns a response, the processing of the service is continued, thereby converting the asynchronous communication mode of the terminal application into the synchronous communication mode.
如图 3所示, 该系统包括: 无线终端 300内部的应用单元 301、 阻塞控件 302、 Brew平台 303以及服务器 400, 其中:  As shown in FIG. 3, the system includes: an application unit 301, a blocking control 302, a Brew platform 303, and a server 400 inside the wireless terminal 300, wherein:
应用单元 301, 用于向阻塞控件 302预置请求消息所对应的回调方法, 在 发出请求消息时, 启动阻塞控件 302锁定 UI, 其中预置请求消息所对应的回 调方法可通过注册请求消息的标识及该请求消息对应的回调方法来实现。  The application unit 301 is configured to preset a callback method corresponding to the request message to the blocking control 302. When the request message is sent, the blocking control 302 is started to lock the UI, where the callback method corresponding to the preset request message can be identified by the registration request message. And the callback method corresponding to the request message is implemented.
阻塞控件 302, 用于接收并保存应用单元 301预置的请求消息所对应的回 调方法,如保存请求消息的标识及对应的回调方法,并在接收到 Brew平台 303 所转发的返回消息时, 比较返回消息的标识与所述请求消息的标识是否相同, 如果是,则调用已注册的请求消息对应的回调方法处理, 并卸载阻塞控件解除 UI锁定; The blocking control 302 is configured to receive and save the corresponding message corresponding to the request message preset by the application unit 301. The method, such as saving the identifier of the request message and the corresponding callback method, and receiving the return message forwarded by the Brew platform 303, comparing whether the identifier of the returned message is the same as the identifier of the request message, and if so, the call has been The callback method corresponding to the registered request message is processed, and the blocking control is uninstalled to release the UI lock;
Brew平台 303 ,用于将应用单元 301发送的请求消息转发到服务器 400, 并将服务器 400返回的响应消息发送到应用单元 301所使用的阻塞控件 302; 服务器 400, 用于接收应用单元 301所发送的请求消息并进行相应处理, 并发回响应消息。  The Brew platform 303 is configured to forward the request message sent by the application unit 301 to the server 400, and send the response message returned by the server 400 to the blocking control 302 used by the application unit 301. The server 400 is configured to receive the sending by the application unit 301. The request message is processed accordingly and a response message is sent back.
为了给用户提供更加友好的人机交互界面,避免陷入无限循环而无法及时 响应系统消息而导致无线终端的强制性重新启动,在阻塞控件 302中设置一个 定时器,并在初始化时由应用单元 301向阻塞控件 302注册超时控制回调方法, 以及在启动阻塞控件 302 时同时启动该定时器, 进而在定时器超过预置时间 时,如果还没有收到该请求消息的响应消息, 则阻塞控件 302调用已注册的超 时控制回调方法, 并卸载阻塞控件以解除 UI锁定。  In order to provide a more friendly human-computer interaction interface for the user, avoiding an infinite loop and failing to respond to the system message in time to cause a mandatory restart of the wireless terminal, a timer is set in the blocking control 302, and is initialized by the application unit 301. Registering the timeout control callback method with the blocking control 302, and simultaneously starting the blocking control 302, and then, when the timer exceeds the preset time, if the response message of the request message has not been received, the blocking control 302 is called. The registered timeout controls the callback method and unloads the blocking control to unlock the UI.
本系统中 Brew平台是将请求消息发送到终端通信模块, 由终端通信模块 通过无线网络将消息传送到服务器,服务器返回的消息也是先通过无线网络传 输到终端通信模块, 并由终端通信模块发送到 Brew平台。  In the system, the Brew platform sends a request message to the terminal communication module, and the terminal communication module transmits the message to the server through the wireless network, and the message returned by the server is first transmitted to the terminal communication module through the wireless network, and is sent by the terminal communication module to the terminal. Brew platform.
本发明实施例还提供了一种用于终端与服务器通过单线程平台通信的装 置, 即阻塞控件 302, 如图 3所示, 以将终端应用的异步通信方式转变为同步 通信方式。阻塞控件 302包括:存储单元 3021、比较单元 3022、执行单元 3023, 其中:  The embodiment of the present invention further provides a device for communicating between a terminal and a server through a single-thread platform, that is, an blocking control 302, as shown in FIG. 3, to convert the asynchronous communication mode of the terminal application into a synchronous communication mode. The blocking control 302 includes a storage unit 3021, a comparison unit 3022, and an execution unit 3023, where:
存储单元 3021 , 用于保存应用单元 301发送的请求消息所对应的回调方 法, 如保存所述清求消息的标识及该消息所对应的回调方法(即回调信息); 比较单元 3022,用于将 Brew平台 303所转发的服务器 400返回的消息和 应用单元 301 发送的请求消息的标识作对比, 并将比较结果发送到执行单元 3023; 由于存储单元 3021中已保存应用单元 301所发送的请求消息的标识, 故可将返回消息的标识直接与存储单元 3021 中所保存的请求消息的标识作对 比。  The storage unit 3021 is configured to save a callback method corresponding to the request message sent by the application unit 301, such as saving the identifier of the clear request message and a callback method corresponding to the message (ie, callback information); and comparing unit 3022, The message returned by the server 400 forwarded by the Brew platform 303 is compared with the identifier of the request message sent by the application unit 301, and the comparison result is sent to the execution unit 3023; since the request message sent by the application unit 301 has been saved in the storage unit 3021. The identifier, so the identifier of the return message can be directly compared with the identifier of the request message held in the storage unit 3021.
执行单元 3023 , 用于锁定 UI, 根据比较单元 3022所发送的结果, 调用相 应的方法处理,如果返回消息与应用单元 301所发送的请求消息标识相同,调 用存储单元 3021中保存的请求消息对应的回调方法进行处理, 并卸载阻塞控 件以解除 UI锁定。 The executing unit 3023 is configured to lock the UI, and invoke the phase according to the result sent by the comparing unit 3022. The method should be processed. If the return message is the same as the request message identifier sent by the application unit 301, the callback method corresponding to the request message saved in the storage unit 3021 is called for processing, and the blocking control is uninstalled to release the UI lock.
为了给用户提供更为人性化的交互界面, 该装置还可以包括计时单元 3024,此时存储单元 3021还用于存储应用单元 301注册的超时控制回调方法; 计时单元 3024用于锁定 UI时开始计时, 并当超时时通知执行单元 3023; 执行单元 3023用于在接收到计时单元 3024的通知并且没有收到比较单元 的标识相同比较结果时调用存储单元 3021中已注册的超时控制回调方法进行 处理, 并卸载阻塞控件以解除 UI锁定。  In order to provide a more user-friendly interactive interface, the device may further include a timing unit 3024. The storage unit 3021 is further configured to store a timeout control callback method registered by the application unit 301. The timing unit 3024 is configured to start timing when the UI is locked. And the execution unit 3023 is notified when the timeout occurs; the execution unit 3023 is configured to call the timeout control callback method registered in the storage unit 3021 to process when the notification of the timing unit 3024 is received and the same comparison result of the identification of the comparison unit is not received, And uninstall the blocking control to unlock the UI.
根据上述描述可知,关于超时控制回调方法的相关处理是可选方案,因此, 可以认为应用单元 301向阻塞控件 302预置的回调信息至少包括请求消息所对 应的回调信息, 有可能还包括超时控制回调信息, 进而, 存储单元 3021存储 的信息包括应用单元 3023向其预置的所述请求消息对应的回调信息, 还可能 包括超时控制回调信息。  According to the above description, the related processing of the timeout control callback method is optional. Therefore, the callback information preset by the application unit 301 to the blocking control 302 may include at least the callback information corresponding to the request message, and may also include a timeout control. The callback information is further included, and the information stored by the storage unit 3021 includes callback information corresponding to the request message preset by the application unit 3023, and may further include timeout control callback information.
相应的, 执行单元 3023還辑上可以认为包括第一执行单元和第二执行单 元两个执行单元,其中, 第一执行单元在应用单元 301发送请求消息时锁定用 户接口,并在比较单元 3022告知的比较结果为标识相同时,调用存储单元 3021 中存储的所述请求消息对应的回调信息进行处理, 并解除所述用户接口锁定。 第二执行单元用于当接收到计时单元 3024的超过预置时间通知并且比较单元 3022没有得出相同的比较结果时,调用存储单元 3021存储的超时控制回调信 息进行处理, 并解除用户接口锁定。  Correspondingly, the execution unit 3023 can also be considered to include two execution units, the first execution unit and the second execution unit, wherein the first execution unit locks the user interface when the application unit 301 sends the request message, and informs the comparison unit 3022. When the comparison result is the same, the callback information corresponding to the request message stored in the storage unit 3021 is called for processing, and the user interface is unlocked. The second execution unit is configured to, when receiving the preset time notification of the timing unit 3024 and the comparison unit 3022 does not obtain the same comparison result, call the timeout control callback information stored by the storage unit 3021 for processing, and release the user interface lock.
如果终端和服务器构成的系统比较稳定,也可以不执行超时控制回调信息 的相关处理, 即应用单元 301无需向阻塞控件 302预置超时控制回调信息,进 而阻塞控件 302也无需设置第二执行单元, 当然计时单元 3024也就无需存在 了。  If the system formed by the terminal and the server is relatively stable, the related processing of the timeout control callback information may not be performed, that is, the application unit 301 does not need to preset the timeout control callback information to the blocking control 302, and thus the blocking control 302 does not need to set the second execution unit. Of course, the timing unit 3024 does not need to exist.
此外需要说明的是, 比较单元 3022比较请求消息标识与服务器返回消息 标识是否相同的目的在于:确定服务器返回消息是否为已发送的请求消息的响 应消息,如果标识相同, 则说明服务器返回消息是已发送的请求消息的响应消 息,如果标识不同,则说明服务器返回消息不是已发送的请求消息的响应消息。 因此, 比较标识只是确定终端是否收到请求消息的响应的一个具体实施方式, 只要能够确定出服务器返回消息是否为已发送请求消息的响应消息的任何一 种功能单元均可代替比较单元 3022, 可将此类功能单元统称为确定单元, 该 确定单元用于确定服务器返回消息是否为已发送的请求消息的响应消息。进一 步, 如果系统比较稳定, 终端中不需设置第二执行单元, 那么所述确定单元和 第一执行单元共同完成的对用户接口进行阻塞处理的基本功能,即在终端发送 请求消息时锁定用户接口,并在终端收到服务器返回的所述请求消息的响应消 息时,调用所述存储单元中存储的所述请求消息对应的回调信息进行处理并解 除所述用户接口锁定。 由此, 可以将确定单元和第一执行单元合并在一起, 称 为阻塞处理单元。 In addition, it should be noted that the comparison unit 3022 compares whether the request message identifier and the server return message identifier are the same in the purpose of: determining whether the server return message is a response message of the sent request message, and if the identifiers are the same, the server returns that the message is The response message of the sent request message, if the identifier is different, indicates that the server returns a message that is not a response message of the sent request message. Therefore, the comparison identifier is only one specific embodiment for determining whether the terminal receives the response of the request message, and any functional unit that can determine whether the server return message is a response message of the sent request message can replace the comparison unit 3022. Such functional units are collectively referred to as a determining unit for determining whether the server returns a message as a response message to the transmitted request message. Further, if the system is relatively stable, and the second execution unit is not required to be set in the terminal, the basic function of blocking the user interface performed by the determining unit and the first execution unit is to lock the user interface when the terminal sends the request message. And when the terminal receives the response message of the request message returned by the server, calling the callback information corresponding to the request message stored in the storage unit to process and unlock the user interface. Thereby, the determining unit and the first executing unit can be merged together, which is called a blocking processing unit.
通过以上本发明各实施例的技术方案可以看出,通过在终端发送请求消息 时锁定 UI, 只有终端收到该请求消息的响应消息时才能按照预置的回调信息 处理并解除 UI的锁定; 否则保持 UI锁定, 使得终端不对键盘、 屏幕、 触摸板 等处理请求做出响应,从而实现单线程平台上消息的同步, 为在单线程平台的 无线终端上开发 C/S、 B/S这类应用提供了便捷的同步通信的方法。  According to the technical solution of the embodiments of the present invention, the UI is locked when the terminal sends the request message, and only when the terminal receives the response message of the request message, the terminal can process and release the UI lock according to the preset callback information; Keeping the UI locked, so that the terminal does not respond to processing requests such as keyboard, screen, touchpad, etc., thereby realizing synchronization of messages on a single-threaded platform, and developing applications such as C/S and B/S on a wireless terminal of a single-threaded platform. Provides a convenient way to synchronize communications.
更进一步, 为避免由于网络或服务器故障造成响应消息无法返回,进而造 成用户不必要的等待及可能导致的无线终端强制性启动,本发明的一个实施例 中采取超时控制的方法,使得终端未收到请求消息的响应消息并已超过预置时 间时,可以直接调用预置的超时控制回调信息进行处理并解除 UI锁定;反之, 如果未超过预置时间并且终端没有收到请求消息的响应消息,则保持 UI锁定, 使得终端不对键盘、 屏幕、 触摸板等处理请求做出响应, 从而实现单线程平台 上消息的同步, 为用户提供了更为友好的人机交互界面。  Further, in order to avoid that the response message cannot be returned due to network or server failure, thereby causing unnecessary waiting by the user and possible forced start of the wireless terminal, in one embodiment of the present invention, a method of timeout control is adopted, so that the terminal does not receive When the response message to the request message has exceeded the preset time, the preset timeout control callback information may be directly called for processing and the UI lock is cancelled; otherwise, if the preset time is not exceeded and the terminal does not receive the response message of the request message, Then, the UI is locked, so that the terminal does not respond to the processing request of the keyboard, the screen, the touchpad, etc., thereby realizing the synchronization of the messages on the single-threaded platform, and providing the user with a more friendly human-computer interaction interface.
以上对本发明实施例所提供的一种终端与服务器通信的方案进行了详细 实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同时,对于本领 域的一般技术人员,依据本发明实施例的思想,在具体实施方式及应用范围上 均会由改变之处, 例如, 本发明不仅仅适用于 Brew平台, 对于所有基于单线 程应用平台的终端应用,如果应用之间以及应用与下层平台之间的通信是异步 的, 用本发明实施例所提供的方案均可实现终端与服务器的同步通信。 综上所 述, 本说明书内容不应理解为对本发明的限制。  The foregoing detailed description of a scheme for communicating terminal and server provided by the embodiments of the present invention is only for helping to understand the method and core idea of the present invention. Meanwhile, for those skilled in the art, according to the present invention The idea of the embodiment will be changed in the specific implementation and application scope. For example, the present invention is not only applicable to the Brew platform, but for all terminal applications based on the single-thread application platform, if the application and the application and the lower layer The communication between the platforms is asynchronous, and the synchronous communication between the terminal and the server can be realized by using the solution provided by the embodiment of the present invention. In conclusion, the content of the present specification should not be construed as limiting the invention.

Claims

权 利 要 求 Rights request
1. 一种终端与服务器通信的方法, 用于单线程平台的系统, 其特征在于, 所述方法包括:  A method for communicating a terminal with a server, the system for a single-threaded platform, wherein the method includes:
终端向服务器发送请求消息并锁定用户接口;  The terminal sends a request message to the server and locks the user interface;
终端在收到所述服务器返回的所述请求消息的响应消息时,按照预置的所 述请求消息对应的回调方法处理并解除用户接口锁定。  When receiving the response message of the request message returned by the server, the terminal processes and releases the user interface lock according to the preset callback method corresponding to the request message.
2. 如权利要求 1所述的方法, 其特征在于, 还包括:  2. The method according to claim 1, further comprising:
终端在锁定用户接口时开始计时;  The terminal starts timing when the user interface is locked;
计时超过预置时间而终端未收到所述请求消息的响应消息,则按照预置的 超时控制回调方法处理并解除用户接口锁定。  When the timer exceeds the preset time and the terminal does not receive the response message of the request message, the user interface lock is processed and released according to the preset timeout control callback method.
3. 如权利要求 1或 2所述的方法, 其特征在于, 所述终端在服务器返回 的消息标识与所述请求消息的标识相同时,确定所述服务器返回的消息为所述 请求消息的响应消息。  The method according to claim 1 or 2, wherein, when the message identifier returned by the server is the same as the identifier of the request message, the terminal determines that the message returned by the server is a response of the request message. Message.
4. 一种用于终端与服务器通过单线程平台通信的装置, 其特征在于, 所 述装置包括:  4. An apparatus for communication between a terminal and a server over a single-threaded platform, wherein the apparatus comprises:
存储单元,用于存储回调信息, 所述回调信息至少包括终端发送的请求消 息所对应的回调信息;  a storage unit, configured to store callback information, where the callback information includes at least callback information corresponding to the request message sent by the terminal;
阻塞处理单元, 用于在终端发送请求消息时锁定用户接口,并在终端收到 服务器返回的所述请求消息的响应消息时,调用所述存储单元中存储的所述请 求消息对应的回调信息进行处理并解除所述用户接口锁定。  The blocking processing unit is configured to: when the terminal sends the request message, the user interface is locked, and when the terminal receives the response message of the request message returned by the server, the callback information corresponding to the request message stored in the storage unit is invoked. Process and unlock the user interface.
5. 如权利要求 4所述的装置, 其特征在于, 所述阻塞处理单元具体包括: 确定单元,用于确定终端收到的所述服务器返回的消息是否为所述请求消 息的响应消息;  The device according to claim 4, wherein the blocking processing unit specifically includes: a determining unit, configured to determine, by the terminal, whether the message returned by the server is a response message of the request message;
第一执行单元,用以在终端发送请求消息时锁定用户接口,并在所述确定 单元确定的结果为肯定结果时,调用所述存储单元中存储的所述请求消息对应 的回调信息进行处理并解除所述用户接口锁定。  a first execution unit, configured to: when the terminal sends the request message, lock the user interface, and when the result determined by the determining unit is a positive result, call the callback information corresponding to the request message stored in the storage unit for processing Unlock the user interface.
6. 如权利要求 5所述的装置, 其特征在于,  6. Apparatus according to claim 5 wherein:
所述确定单元具体为比较单元,用于比较服务器返回消息的标识与所述请 求消息的标识是否相同,相同表明所述服务器返回的消息是所述请求消息的响 应消息; 不相同表明所述服务器返回的消息不是所述请求消息的响应消息。The determining unit is specifically a comparing unit, configured to compare whether the identifier of the server return message is the same as the identifier of the request message, and the same indicates that the message returned by the server is the ringing of the request message. The message should be different; indicating that the message returned by the server is not a response message to the request message.
7. 如权利要求 5或 6所述的装置, 其特征在于, 所述存储单元存储的回 调信息还包括超时控制回调信息,所述阻塞处理单元还包括计时单元和第二执 行单元, 其中: The apparatus according to claim 5 or 6, wherein the callback information stored by the storage unit further includes timeout control callback information, and the blocking processing unit further includes a timing unit and a second execution unit, where:
计时单元,用于在锁定用户接口时开始计时, 并当计时超过预置时间时通 知第二执行单元;  a timing unit for starting timing when the user interface is locked, and notifying the second execution unit when the timing exceeds the preset time;
第二执行单元,用于当接收到所述计时单元的超过预置时间通知并且所述 确定单元未得出肯定结果时 ,调用所述存储单元中存储的所述超时控制回调信 息进行处理并解除用户接口锁定。  a second execution unit, configured to invoke the timeout control callback information stored in the storage unit to process and release when the preset time notification of the timing unit is received and the determining unit does not obtain a positive result User interface is locked.
8. 一种终端, 包括应用单元、 单线程平台以及用户接口, 其特征在于, 还包括阻塞控件, 其中:  8. A terminal, comprising an application unit, a single-threaded platform, and a user interface, further comprising: a blocking control, wherein:
应用单元, 用于向阻塞控件预置回调信息,发送请求消息并同时启动阻塞 控件 , 所述预置的回调信息至少包括所述请求消息所对应的回调信息;  An application unit, configured to preset callback information to the blocking control, send a request message, and start the blocking control at the same time, where the preset callback information includes at least callback information corresponding to the request message;
阻塞控件,用于存储应用单元向其预置的回调信息并在所述应用单元发送 请求消息时锁定用户接口,以及在收到服务器返回的所述奇求消息的响应消息 时,调用预置的所述请求消息对应的回调信息进行处理并解除所述用户接口锁 定;  Blocking control for storing callback information preset by the application unit and locking the user interface when the application unit sends the request message, and calling the preset when receiving the response message of the odd request message returned by the server The callback information corresponding to the request message is processed and the user interface is unlocked;
单线程平台, 用于将所述应用单元发送的所述请求消息转发到服务器, 并 将服务器返回的消息转发到所述应用单元所使用的阻塞控件。  The single-threaded platform is configured to forward the request message sent by the application unit to a server, and forward the message returned by the server to an blocking control used by the application unit.
9. 如权利要求 8所述的终端, 其特征在于, 所述阻塞控件具体包括: 存储单元,用于存储回调信息,所述回调信息至少包括终端发送的请求消 息所对应的回调信息;  The terminal according to claim 8, wherein the blocking control specifically includes: a storage unit, configured to store callback information, where the callback information includes at least callback information corresponding to the request message sent by the terminal;
阻塞处理单元,用于在终端向服务器发送请求消息时锁定用户接口, 并在 终端收到所述服务器返回的所述请求消息的响应消息时,调用所述存储单元中 存储的所述请求消息对应的回调信息进行处理并解除所述用户接口锁定。  a blocking processing unit, configured to: when the terminal sends a request message to the server, to lock the user interface, and when the terminal receives the response message of the request message returned by the server, invoke the request message stored in the storage unit The callback information is processed and the user interface is unlocked.
10. 如权利要求 9所述的终端,其特征在于,所述阻塞处理单元具体包括: 确定单元,用于确定终端收到的所述服务器返回的消息是否为所述请求消 息的响应消息;  The terminal according to claim 9, wherein the blocking processing unit comprises: a determining unit, configured to determine whether a message returned by the server received by the terminal is a response message of the request message;
第一执行单元, 用以在终端向服务器发送请求消息时锁定用户接口,并在 所述确定单元确定的结果为肯定结果时,调用所述存储单元中存储的所述请求 消息对应的回调信息进行处理并解除所述用户接口锁定。 a first execution unit, configured to lock the user interface when the terminal sends a request message to the server, and When the result determined by the determining unit is a positive result, the callback information corresponding to the request message stored in the storage unit is invoked for processing and the user interface is unlocked.
11. 如权利要求 10所述的终端, 其特征在于,  11. The terminal of claim 10, wherein:
所述确定单元具体为比较单元,用于比较服务器返回消息的标识与所述请 求消息的标识是否相同,相同表明所述服务器返回的消息是所述请求消息的响 应消息; 不相同表明所述服务器返回的消息不是所述请求消息的响应消息。  The determining unit is specifically a comparing unit, configured to compare whether the identifier of the server return message is the same as the identifier of the request message, and the same indicates that the message returned by the server is a response message of the request message; The returned message is not a response message to the request message.
12. 如权利要求 10或 11所述的终端, 其特征在于, 所述应用单元向阻塞 控件预置的回调信息还包括超时控制回调信息 ,所述存储单元存储的回调信息 还包括所述超时控制回调信息, 所述阻塞控件还包括计时单元和第二执行单 元, 其中:  The terminal device according to claim 10 or 11, wherein the callback information preset by the application unit to the blocking control further includes timeout control callback information, and the callback information stored by the storage unit further includes the timeout control Callback information, the blocking control further includes a timing unit and a second execution unit, wherein:
计时单元,用于在锁定用户接口时开始计时, 并当计时超过预置时间时通 知第二执行单元;  a timing unit for starting timing when the user interface is locked, and notifying the second execution unit when the timing exceeds the preset time;
第二执行单元,用以在接收到计时单元的超过预置时间通知并且所述确定 单元未得出肯定结果时,调用所述第二存储单元存储的超时控制回调信息进行 处理并解除所述用户接口锁定。  a second execution unit, configured to call the timeout control callback information stored by the second storage unit to process and release the user when receiving the preset time notification of the timing unit and the determining unit does not obtain a positive result The interface is locked.
13. 一种终端与服务器通信的系统, 所述系统包括终端和服务器, 其特征 在于, 所述终端包括阻塞控件、 应用单元、 单线程平台及用户接口, 其中: 应用单元,用于向阻塞控件预置回调信息, 向服务器发送请求消息并同时 启动阻塞控件, 所述预置的回调信息至少包括所述请求消息所对应的回调信 阻塞控件,用于存储所述应用单元向其预置的回调信息并在所述应用单元 发送请求消息时锁定用户接口,以及在收到所述服务器返回的所述请求消息的 响应消息时调用预置的所述请求消息对应的回调信息处理并解除用户接口锁 定;  A system for communicating with a server, the system comprising a terminal and a server, wherein the terminal comprises a blocking control, an application unit, a single-threaded platform and a user interface, wherein: the application unit is configured to block the control The preset callback information is sent to the server and the blocking control is started at the same time. The preset callback information includes at least a callback blocking control corresponding to the request message, and is used to store a callback preset by the application unit. And locking the user interface when the application unit sends the request message, and calling the preset callback information processing corresponding to the request message and releasing the user interface lock when receiving the response message of the request message returned by the server ;
单线程平台, 用于将所述应用单元发送的请求消息转发到服务器, 并将服 务器返回的消息转发到所述应用单元所使用的阻塞控件;  a single-threaded platform, configured to forward the request message sent by the application unit to the server, and forward the message returned by the server to the blocking control used by the application unit;
服务器, 用于处理应用单元发出的请求消息, 并返回消息到单线程平台。 A server that processes the request message sent by the application unit and returns the message to the single-threaded platform.
14. 如权利要求 13所述的系统, 其特征在于, 所述阻塞控件具体包括: 存储单元,用于存储回调信息,所述回调信息至少包括终端发送的请求消 息所对应的回调信息; The system of claim 13, wherein the blocking control comprises: a storage unit, configured to store callback information, where the callback information includes at least a request sent by the terminal. Callback information corresponding to the interest;
阻塞处理单元,用于在终端向服务器发送请求消息时锁定用户接口, 并在 终端收到所述月艮务器返回的所述请求消息的响应消息时,调用所述存储单元中 存储的所述请求消息对应的回调信息进行处理并解除所述用户接口锁定。  a blocking processing unit, configured to: when the terminal sends a request message to the server, to lock the user interface, and when the terminal receives the response message of the request message returned by the server, invoke the The callback information corresponding to the request message is processed and the user interface is unlocked.
15. 如权利要求 14所述的系统, 其特征在于, 所述阻塞处理单元具体包 括:  The system according to claim 14, wherein the blocking processing unit specifically comprises:
确定单元,用于确定终端收到的所述服务器返回的消息是否为所述请求消 息的响应消息;  a determining unit, configured to determine whether the message returned by the server received by the terminal is a response message of the request message;
第一执行单元,用以在终端向服务器发送请求消息时锁定用户接口, 并在 所述确定单元确定的结果为肯定结果时,调用所述存储单元中存储的所述请求 消息对应的回调信息进行处理并解除所述用户接口锁定。  a first execution unit, configured to: when the terminal sends a request message to the server, to lock the user interface, and when the result determined by the determining unit is a positive result, call the callback information corresponding to the request message stored in the storage unit Process and unlock the user interface.
16. 如权利要求 15所述的系统, 其特征在于, 所述应用单元向阻塞控件 预置的回调信息还包括超时控制回调信息,所述存储单元存储的回调信息还包 括所述超时控制回调信息,所述阻塞控件还包括计时单元和第二执行单元,其 中:  The system according to claim 15, wherein the callback information preset by the application unit to the blocking control further includes timeout control callback information, and the callback information stored by the storage unit further includes the timeout control callback information. The blocking control further includes a timing unit and a second execution unit, wherein:
计时单元,用于在锁定用户接口时开始计时并当计时超过预置时间时通知 第二执行单元;  a timing unit for starting timing when the user interface is locked and notifying the second execution unit when the timing exceeds the preset time;
第二执行单元,用以在接收到计时单元的超过预置时间通知并且所述确定 单元未得出肯定结果时,调用所述第二存储单元存储的超时控制回调信息进行 处理并解除所述用户接口锁定。  a second execution unit, configured to call the timeout control callback information stored by the second storage unit to process and release the user when receiving the preset time notification of the timing unit and the determining unit does not obtain a positive result The interface is locked.
17. 如权利要求 13至 16中任意一项所述的系统, 其特征在于, 所述系统 还包括终端通信模块,用于将单线程平台发送的请求消息通过无线网络发送到 服务器, 并将服务器返回的消息发送到单线程平台。  The system according to any one of claims 13 to 16, wherein the system further comprises a terminal communication module, configured to send a request message sent by the single-threaded platform to the server through the wireless network, and the server The returned message is sent to a single-threaded platform.
PCT/CN2007/001120 2006-08-28 2007-04-06 Method, system, and apparatus for communication between a terminal and a server WO2008025198A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CNB2006101119672A CN100442897C (en) 2006-08-28 2006-08-28 Terminal and server communication method, system and device
CN200610111967.2 2006-08-28

Publications (1)

Publication Number Publication Date
WO2008025198A1 true WO2008025198A1 (en) 2008-03-06

Family

ID=37955016

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2007/001120 WO2008025198A1 (en) 2006-08-28 2007-04-06 Method, system, and apparatus for communication between a terminal and a server

Country Status (2)

Country Link
CN (1) CN100442897C (en)
WO (1) WO2008025198A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882920B (en) * 2012-06-25 2016-01-20 深圳市同洲电子股份有限公司 The control method of digital television system, system and relevant device
CN104506642B (en) * 2014-12-30 2018-06-22 深圳市兰丁科技有限公司 A kind of efficient transmitting-receiving of client message and processing method and system
CN108986821B (en) * 2018-08-23 2021-03-23 珠海格力电器股份有限公司 Method and equipment for setting relation between room and equipment
CN110287037B (en) * 2019-05-20 2023-11-03 平安科技(深圳)有限公司 Distributed intelligent API asynchronous callback method and device
CN111585808A (en) * 2020-04-30 2020-08-25 中国科学院空天信息创新研究院 Message processing method, device, equipment and computer readable storage medium
CN111813733B (en) * 2020-06-30 2022-05-13 厦门科灿信息技术有限公司 Synchronous communication method, system and terminal equipment based on Modbus protocol
CN117729172A (en) * 2024-02-18 2024-03-19 成都深瑞同华科技有限公司 Data transmission method, device and storage medium in isolated network environment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1394037A (en) * 2001-06-25 2003-01-29 华为技术有限公司 Method for implementing interface between workstation and operating system of telecommunication management network
US6697849B1 (en) * 1999-08-13 2004-02-24 Sun Microsystems, Inc. System and method for caching JavaServer Pages™ responses
US7003610B2 (en) * 2002-09-20 2006-02-21 Lsi Logic Corporation System and method for handling shared resource writes arriving via non-maskable interrupts (NMI) in single thread non-mission critical systems with limited memory space
CN1811719A (en) * 2006-02-22 2006-08-02 福建师范大学 Method for detecting and intervening deadlock of single-threading microprocessor

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2655794A1 (en) * 1989-12-13 1991-06-14 Cit Alcatel SYNCHRONOUS-ASYNCHRONOUS CONVERTER.
JP2001095033A (en) * 1999-07-28 2001-04-06 Hyundai Electronics Ind Co Ltd Method and device for linking sunchronous core network with asynchronous radio network
US7251256B1 (en) * 2000-05-18 2007-07-31 Luminous Networks, Inc. Synchronization of asynchronous networks using media access control (MAC) layer synchronization symbols
WO2003075585A1 (en) * 2002-03-04 2003-09-12 Nokia Corporation Method for intermediate unlocking of a keypad on a mobile electronic device
US8055821B2 (en) * 2004-11-17 2011-11-08 International Business Machines Corporation Apparatus, system, and method for converting a synchronous interface into an asynchronous interface

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6697849B1 (en) * 1999-08-13 2004-02-24 Sun Microsystems, Inc. System and method for caching JavaServer Pages™ responses
CN1394037A (en) * 2001-06-25 2003-01-29 华为技术有限公司 Method for implementing interface between workstation and operating system of telecommunication management network
US7003610B2 (en) * 2002-09-20 2006-02-21 Lsi Logic Corporation System and method for handling shared resource writes arriving via non-maskable interrupts (NMI) in single thread non-mission critical systems with limited memory space
CN1811719A (en) * 2006-02-22 2006-08-02 福建师范大学 Method for detecting and intervening deadlock of single-threading microprocessor

Also Published As

Publication number Publication date
CN100442897C (en) 2008-12-10
CN1937811A (en) 2007-03-28

Similar Documents

Publication Publication Date Title
US8910138B2 (en) Hot pluggable extensions for access management system
US8196142B2 (en) Use of external services with clusters
WO2008025198A1 (en) Method, system, and apparatus for communication between a terminal and a server
WO2011147218A1 (en) Method for implementing application management and non-intelligent mobile terminal
CN107665302B (en) Android application multi-open implementation method, mobile terminal and storage medium
WO2023093429A1 (en) Micro-application running method and apparatus, and device, storage medium and program product
WO2014101393A1 (en) Application implementation method and device
US20080062962A1 (en) Resetting / restarting SIP endpoint devices
WO2011009346A1 (en) Mobile phone application starting method, device and system
CN111258723B (en) Transaction processing method, device, system, medium and equipment of distributed system
WO2009009968A1 (en) A method, device and system for acquiring login information
US11411812B2 (en) Dynamic service creation for microservice-based integration service
WO2021093671A1 (en) Task processing method, system, apparatus and device, and computer readable storage medium
WO2015184902A1 (en) Concurrent processing method for intelligent split-screen and corresponding intelligent terminal
EP3352415A1 (en) Smb service failure handling method, and storage device
JP2004523812A (en) Efficient timer management system
WO2007022696A1 (en) A method and a network management apparatus for implementing information service hierarchy inherited relation in the network management interface
KR20110122996A (en) Apparatus for executing application, method thereof and computer recordable medium storing the method
CN115190158A (en) Information interaction method, information interaction device, information interaction system and storage medium
WO2012055176A1 (en) Processing method for mobile terminal and mobile terminal
WO2017001916A1 (en) System and method for reacquiring a running service after restarting a configurable platform instance
CN112130900A (en) User information management method, system, equipment and medium for BMC
JP2003303161A (en) Device driver incorporating/executing system, incorporating/executing method, and program
KR100962614B1 (en) Radiocommunication module that runs a main software program, the low-level layers of which are open to a client software program which is also run by the module
CN112866336B (en) Asynchronous network communication method, communication system, device and storage medium

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: 07720693

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

NENP Non-entry into the national phase

Ref country code: RU

122 Ep: pct application non-entry in european phase

Ref document number: 07720693

Country of ref document: EP

Kind code of ref document: A1