Service calling method and device, equipment and storage medium
By receiving and sending instruction messages in near-field communication, the design of the protocol stack is simplified, the complexity problem of protocol stack is solved, and a simpler call process is realized.
Patent Information
- Application Number
- CN202510538892.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-22
AI Technical Summary
In the prior art, the design of the near field communication protocol stack is complicated, which leads to difficulty in maintenance and the caller's use process.
By receiving the service call request from the user side, generating instruction messages, and communicating with the controller based on the near field communication protocol, waiting and sending preset services, the protocol stack design is simplified to synchronous processing.
It reduces the design complexity of the protocol stack, makes the calling process simpler, and avoids maintenance difficulties caused by asynchronous processing.
Smart Images

Figure CN120523618A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of near field communication technology, and in particular to a service invocation method, apparatus, device, and storage medium. Background Art
[0002] Currently, host systems and controllers communicate based on the Near Field Communication (NFC) protocol. Specifically, the host system sends commands to the controller according to the protocol specifications to implement NFC-related functions. Therefore, both the controller and the host system require modules or code to process the protocol. The protocol processing module in the host system is called the protocol stack.
[0003] Currently, since the protocol stack processing process is asynchronous, the design of the protocol stack itself will be very complex, subsequent maintenance will be difficult, and the caller will be complicated to use.
[0004] Therefore, there is an urgent need for a service calling method that can reduce the complexity of the protocol stack design itself and simplify the use process for the caller. Summary of the Invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide a service calling method, apparatus, device and storage medium.
[0006] A first aspect of an embodiment of the present disclosure provides a service calling method, which is applied to a protocol stack thread. The method includes:
[0007] receiving a service call request sent by a user end, and generating a corresponding instruction message according to the service call request; wherein the service call request is used to indicate that a preset service is called to a controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on a near field communication protocol;
[0008] Sending the corresponding instruction message to the controller and waiting to receive the preset service; wherein the controller is used to call the preset service according to the corresponding instruction message;
[0009] The preset service is sent to the user end.
[0010] In one example, the sending of the corresponding instruction message to the controller and waiting for receiving the preset service includes:
[0011] Sending the corresponding instruction message to the controller and waiting for a feedback message; wherein the feedback message is generated by the controller according to the corresponding instruction message;
[0012] If the feedback message is received within the first preset time, the feedback message is saved and a notification message is waited for; wherein the notification message is sent after the controller sends the feedback message;
[0013] If the notification message is received within the second preset time, the notification message is saved; wherein the notification message and the feedback message are the preset service.
[0014] In one example, sending the preset service to the user terminal includes:
[0015] The notification message and the feedback message are sent to the user end.
[0016] In one example, after waiting for the feedback message, the method further includes:
[0017] If the feedback message is not received within the first preset time, the result of the call failure is sent to the user end.
[0018] In one example, after saving the feedback message and waiting for a notification message, the method further includes:
[0019] If the notification message is not received within the second preset time, the result of the call failure is sent to the user end.
[0020] A second aspect of the embodiments of the present disclosure provides a service calling method, which is applied to a user end and includes:
[0021] Sending a service call request to a protocol stack thread; wherein the service call request is used to indicate calling a preset service to a controller; the protocol stack thread generates a corresponding instruction message according to the service call request; the corresponding instruction message is used to instruct the controller to call the preset service;
[0022] The preset service is received.
[0023] In one example, after sending the service call request to the protocol stack thread, the method further includes:
[0024] Receive a result of a call failure; wherein the result of the call failure is sent by the protocol stack thread.
[0025] A third aspect of the embodiments of the present disclosure provides a service calling device, which is applied to a protocol stack thread. The device includes:
[0026] A first receiving module is configured to receive a service call request sent by a user end and generate a corresponding instruction message according to the service call request; wherein the service call request is used to indicate that a preset service is called to a controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on a near field communication protocol;
[0027] a first sending module, configured to send the corresponding instruction message to the controller and wait for receiving the preset service; wherein the controller is configured to call the preset service according to the corresponding instruction message;
[0028] The second sending module is used to send the preset service to the user end.
[0029] A fourth aspect of the embodiments of the present disclosure provides a service invoking device, which is applied to a user end. The device includes:
[0030] A third sending module is configured to send a service call request to a protocol stack thread; wherein the service call request is used to indicate calling a preset service to the controller; the protocol stack thread generates a corresponding instruction message according to the service call request; and the corresponding instruction message is used to instruct the controller to call the preset service;
[0031] The second receiving module is configured to receive the preset service.
[0032] A fifth aspect of an embodiment of the present disclosure provides an electronic device, comprising: a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method of the first or second aspect above.
[0033] A sixth aspect of an embodiment of the present disclosure provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method of the first aspect or the second aspect can be implemented.
[0034] The disclosed embodiments provide a service calling method, apparatus, device, and storage medium, the method comprising: receiving a service calling request sent by a user end, and generating a corresponding instruction message according to the service calling request; wherein the service calling request is used to indicate calling a preset service to a controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on a near field communication protocol; the corresponding instruction message is sent to the controller, and the preset service is waited for; wherein the controller is used to call the preset service according to the corresponding instruction message; and the preset service is sent to the user end. The adoption of this technical solution can reduce the complexity of the design of the protocol stack itself, and the use process of the caller is simple. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0036] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0037] Figure 1 A schematic diagram showing the process of an asynchronous callback function result;
[0038] Figure 2 A signaling interaction diagram for asynchronously sending and receiving instructions is shown;
[0039] Figure 3 This is a flow chart of a service calling method provided by an embodiment of the present disclosure;
[0040] Figure 4 This is a schematic diagram of a service calling process provided by an embodiment of the present disclosure;
[0041] Figure 5 This is a flow chart of a service calling method provided by an embodiment of the present disclosure;
[0042] Figure 6 This is a signaling interaction diagram for a service call provided by an embodiment of the present disclosure;
[0043] Figure 7 This is a flow chart of a service calling method provided by an embodiment of the present disclosure;
[0044] Figure 8 This is a structural diagram of a service calling device provided by an embodiment of the present disclosure;
[0045] Figure 9 This is a structural diagram of a service calling device provided by an embodiment of the present disclosure;
[0046] Figure 10 It is a structural diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0047] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0048] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0049] The current protocol stack runs on the Android system and is designed based on an asynchronous API, which means that after a function call, you need to wait for the result returned by the callback function. Figure 1 The following is a schematic diagram showing the process of an asynchronous callback function result. Figure 1 The design requires the protocol stack to maintain multiple state machines. Since each function requires a corresponding state machine, the majority of the code in the protocol stack is dedicated to maintaining the state machines. Adding or removing functionality from the protocol stack requires maintaining the existing state machines, which complicates code modifications.
[0050] Secondly, for the user side, when calling the protocol stack's asynchronous API, it is necessary to add waiting logic and wake-up logic on the caller side. Furthermore, the user side needs to configure the synchronization protection function. Otherwise, the protocol stack may have completed the wake-up operation, but the user side has not yet waited for the operation in real time, resulting in no callback result after the wait operation.
[0051] For a clearer explanation, see Figure 2The figure shows a signaling interaction diagram of asynchronous sending and receiving instructions. The reason why the protocol stack adopts asynchronous design is mainly because the sending and receiving of near field communication controller (NFC Controller Interface, referred to as NCI) instructions are asynchronous. After the upper computer system sends the NCI instruction to the controller, it needs to wait for the controller to reply with a feedback message or notification message. After receiving the feedback message and notification message, the protocol stack processes the data and then calls back to the caller. Taking the NCI_CORE_RESET instruction as an example, the NCI_CORE_RESET instruction is the reset operation of the control controller, which is generally used in the NFC switch process. After the CMD instruction is sent, the controller should reply with an NCI_CORE_RESET_RSP and then report an NCI_CORE_RESET_NTF. From Figure 2 As can be seen from the figure, the related technology is executed based on multiple threads in the protocol stack.
[0052] Figure 3 This is a flow chart of a service calling method provided by an embodiment of the present disclosure, which is applied to a protocol stack thread and can be executed by an electronic device. The electronic device can be exemplarily understood as a device such as a mobile phone, tablet computer, laptop computer, desktop computer, smart TV, etc. Figure 3 As shown, the method provided in this embodiment includes the following steps:
[0053] S301. Receive a service call request sent by a user end, and generate a corresponding instruction message according to the service call request; wherein the service call request is used to represent the call of a preset service to the controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on the near field communication protocol.
[0054] In one example, the user end is the service caller, which is generally a preset system, for example, an Android system. The service call request sent by the user end can be an API call interface, and then the protocol stack thread generates a corresponding instruction message according to the service call request. In this embodiment, there is one protocol stack thread. The instruction message can be NCI_CORE_RESET_CMD. For a clearer explanation, please refer to Figure 4 A service calling process diagram is shown in FIG. Figure 4 It can be seen that the user terminal communicates with the controller through the protocol stack thread. In this embodiment, the protocol stack thread is encapsulated in the synchronous transport layer.
[0055] S302: Send the corresponding instruction message to the controller and wait for receiving the preset service; wherein the controller is used to call the preset service according to the corresponding instruction message.
[0056] In one example, the protocol stack thread sends NCI_CORE_RESET_CMD to the controller, and then the controller calls a preset service according to the corresponding instruction message.
[0057] S303: Send the preset service to the user end.
[0058] In one example, the controller sends the preset service to the protocol stack thread, which then sends it to the user end so that the user end uses the preset service.
[0059] The disclosed embodiment provides a service invocation method, comprising: receiving a service invocation request sent by a user end, generating a corresponding instruction message based on the service invocation request; wherein the service invocation request is used to indicate the invocation of a preset service to a controller; the corresponding instruction message is used to instruct the controller to invoke the preset service; the user end and the controller communicate based on a near-field communication protocol; the corresponding instruction message is sent to the controller and waits for receipt of the preset service; wherein the controller is used to invoke the preset service based on the corresponding instruction message; and the preset service is sent to the user end. The adoption of this technical solution can reduce the complexity of the protocol stack design itself and simplify the use process for the caller.
[0060] Figure 5 The flowchart of a service calling method provided by the embodiment of the present disclosure is shown. Applied to the protocol stack thread, the embodiment of the present disclosure is optimized based on the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0061] like Figure 5 As shown, the service calling method may include the following steps:
[0062] S501. Receive a service call request sent by a user end, and generate a corresponding instruction message according to the service call request; wherein the service call request is used to represent the call of a preset service to the controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on the near field communication protocol.
[0063] In an example, this step can refer to the content of step S301 and will not be repeated here.
[0064] S502: Send the corresponding instruction message to the controller and wait for a feedback message; wherein the feedback message is generated by the controller according to the corresponding instruction message.
[0065] In one example, the feedback message is used to indicate that the controller has successfully received the corresponding instruction message. In this embodiment, the protocol stack thread sends the corresponding instruction message to the controller and then waits for the feedback message. The feedback message may be NCI_CORE_RESET_RSP.
[0066] S503: If the feedback message is received within the first preset time, save the feedback message and wait for a notification message; wherein the notification message is sent after the controller sends the feedback message.
[0067] In one example, the first preset time is a preconfigured time. If a feedback message is received within this time, it indicates that the controller has successfully received the corresponding instruction message. The controller then saves the feedback message and waits for a notification message indicating that the controller has successfully processed the corresponding instruction message. The notification message may be NCI_CORE_RESET_NTF.
[0068] In one example, after waiting for the feedback message, the method further includes:
[0069] If no feedback message is received within the first preset time, the result of the call failure is sent to the user end.
[0070] In one example, if no feedback message is received within the first preset time, it means that the controller has not received the corresponding instruction message, and the result of the call failure is sent to the user end.
[0071] S504: If the notification message is received within the second preset time, the notification message is saved; wherein the notification message and the feedback message are preset services.
[0072] In one example, the second preset time is a pre-configured time. If the notification message is received within the second preset time, it means that the controller has successfully processed the corresponding instruction message, and the notification message is saved.
[0073] In one example, after saving the feedback message and waiting for the notification message, the method further includes:
[0074] If no notification message is received within the second preset time, the result of the call failure is sent to the user end.
[0075] In one example, if no notification message is received within the second preset time, it means that the controller has not processed the corresponding instruction message, and the result of the call failure is sent to the user end.
[0076] S505: Send the notification message and feedback message to the user end.
[0077] In one example, after waiting for receipt of the notification message, the saved feedback message and the notification message are sent to the user end together.
[0078] For a clearer explanation, see Figure 6 A signaling interaction diagram of a service call is shown.
[0079] The disclosed embodiments provide a service invocation method, comprising: receiving a service invocation request from a user end, generating a corresponding instruction message based on the service invocation request, sending the corresponding instruction message to a controller, and waiting for a feedback message; if the feedback message is received within a first preset time, saving the feedback message, and waiting for a notification message; if the notification message is received within a second preset time, saving the notification message, and sending the notification message and the feedback message to the user end. Using this technical solution, the bottom layer of the protocol stack converts asynchronous operation to synchronous operation. Subsequently, the main logic of the NCI protocol stack based on the synchronous NCI transceiver system can adopt a synchronous design, and the externally exposed API interface can also adopt a synchronous design, thereby achieving the goal of simplifying the protocol stack design.
[0080] Figure 7 The following is a flow chart of a service calling method provided by an embodiment of the present disclosure. Applied to the user end, the embodiment of the present disclosure is optimized based on the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0081] like Figure 7 As shown, the service calling method may include the following steps:
[0082] S701. Send a service call request to a protocol stack thread; wherein the service call request is used to indicate calling a preset service to a controller; the protocol stack thread generates a corresponding instruction message according to the service call request; the corresponding instruction message is used to instruct the controller to call the preset service.
[0083] In one example, after sending the service call request to the protocol stack thread, the method further includes:
[0084] Receive the result of the call failure; wherein the result of the call failure is sent by the protocol stack thread.
[0085] S702: Receive a preset service.
[0086] In one example, the user end receives a preset service sent by a protocol stack thread and executes the preset service.
[0087] The disclosed embodiments provide a service invocation method, comprising: sending a service invocation request to a protocol stack thread, and receiving a preset service. This technical solution allows a user to use the protocol stack API as a normal function, eliminating the need for additional synchronization protection and fundamentally resolving deadlock issues.
[0088] Figure 8This is a structural diagram of a service calling device provided by an embodiment of the present disclosure, which is applied to a protocol stack thread. The service calling device can be understood as the above-mentioned electronic device or a part of the functional modules in the above-mentioned electronic device. Figure 8 As shown, the service calling device 80 includes:
[0089] The first receiving module 801 is configured to receive a service call request sent by a user end and generate a corresponding instruction message according to the service call request; wherein the service call request is used to indicate that a preset service is called to the controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on the near field communication protocol;
[0090] The first sending module 802 is used to send the corresponding instruction message to the controller and wait for receiving the preset service; wherein the controller is used to call the preset service according to the corresponding instruction message;
[0091] The second sending module 803 is used to send the preset service to the user end.
[0092] In one example, the first sending module 802 is specifically configured to:
[0093] Send the corresponding command message to the controller and wait for the feedback message; wherein the feedback message is generated by the controller according to the corresponding command message;
[0094] If the feedback message is received within the first preset time, the feedback message is saved and a notification message is waited for; wherein the notification message is sent after the controller sends the feedback message;
[0095] If the notification message is received within the second preset time, the notification message is saved; wherein the notification message and the feedback message are preset services.
[0096] In one example, the second sending module 803 is specifically configured to:
[0097] Send notification messages and feedback messages to the user end.
[0098] In one example, after waiting for the feedback message, the apparatus 80 further includes:
[0099] The fourth sending module 804 is configured to send a call failure result to the user end if no feedback message is received within the first preset time.
[0100] In one example, after saving the feedback message and waiting for the notification message, the apparatus 80 further includes:
[0101] The fifth sending module 805 is configured to send a call failure result to the user end if no notification message is received within the second preset time.
[0102] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.
[0103] Figure 9 This is a structural diagram of a service calling device provided by an embodiment of the present disclosure, which is applied to a user end. The service calling device can be understood as the above-mentioned electronic device or a part of the functional modules in the above-mentioned electronic device. Figure 9 As shown, the service calling device 90 includes:
[0104] The third sending module 901 is used to send a service call request to the protocol stack thread; wherein the service call request is used to indicate the call of a preset service to the controller; the protocol stack thread generates a corresponding instruction message according to the service call request; the corresponding instruction message is used to instruct the controller to call the preset service;
[0105] The second receiving module 902 is configured to receive a preset service.
[0106] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.
[0107] An embodiment of the present disclosure further provides an electronic device, which includes: a memory storing a computer program; a processor for executing the computer program, and when the computer program is executed by the processor, the method of any of the above embodiments can be implemented.
[0108] For example, Figure 10 This is a schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 10 , which shows a schematic structural diagram of an electronic device 1000 suitable for implementing the embodiments of the present disclosure. The electronic device 1000 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0109] like Figure 10As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. Various programs and data required for the operation of the electronic device 1000 are also stored in the RAM 1003. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0110] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Figure 10 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0111] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0112] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0113] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0114] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0115] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: receives a service call request sent by the user end, generates a corresponding instruction message according to the service call request; wherein the service call request is used to indicate the call of a preset service to the controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on the near field communication protocol; sends the corresponding instruction message to the controller and waits for the preset service to be received; wherein the controller is used to call the preset service according to the corresponding instruction message; and sends the preset service to the user end. The computer program code for performing the operations of the present disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user computer, partially on the user computer, as a standalone software package, partially on the user computer and partially on a remote computer, or entirely on a remote computer or server. Where a remote computer is involved, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0116] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0117] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0118] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0119] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0120] The embodiments of the present disclosure also provide a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments can be implemented. The execution method and beneficial effects are similar and will not be repeated here.
[0121] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device that includes the element.
[0122] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A service calling method, characterized in that: Applicable to protocol stack threads, including: receiving a service call request sent by a user end, and generating a corresponding instruction message according to the service call request; wherein the service call request is used to indicate that a preset service is called to a controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on a near field communication protocol; Sending the corresponding instruction message to the controller and waiting to receive the preset service; wherein the controller is used to call the preset service according to the corresponding instruction message; The preset service is sent to the user end.
2. The method according to claim 1, characterized in that The method of sending the corresponding instruction message to the controller and waiting to receive the preset service includes: Sending the corresponding instruction message to the controller and waiting for a feedback message; wherein the feedback message is generated by the controller according to the corresponding instruction message; If the feedback message is received within the first preset time, the feedback message is saved and a notification message is waited for; wherein the notification message is sent after the controller sends the feedback message; If the notification message is received within the second preset time, the notification message is saved; wherein the notification message and the feedback message are the preset service.
3. The method according to claim 2, characterized in that The sending of the preset service to the user terminal includes: The notification message and the feedback message are sent to the user end.
4. The method according to claim 2, characterized in that After waiting for the feedback message, the method further includes: If the feedback message is not received within the first preset time, the result of the call failure is sent to the user end.
5. The method according to claim 2, characterized in that After saving the feedback message and waiting for the notification message, the method further includes: If the notification message is not received within the second preset time, the result of the call failure is sent to the user end.
6. A service calling method, characterized in that: Applied to the user end, including: Sending a service call request to a protocol stack thread; wherein the service call request is used to indicate calling a preset service to a controller; the protocol stack thread generates a corresponding instruction message according to the service call request; the corresponding instruction message is used to instruct the controller to call the preset service; The preset service is received.
7. The method according to claim 6, characterized in that After sending the service call request to the protocol stack thread, the method further includes: Receive a result of a call failure; wherein the result of the call failure is sent by the protocol stack thread.
8. A service calling device, characterized in that: Applicable to protocol stack threads, including: A first receiving module is configured to receive a service call request sent by a user end and generate a corresponding instruction message according to the service call request; wherein the service call request is used to indicate that a preset service is called to a controller; the corresponding instruction message is used to instruct the controller to call the preset service; the user end and the controller communicate based on a near field communication protocol; a first sending module, configured to send the corresponding instruction message to the controller and wait for receiving the preset service; wherein the controller is configured to call the preset service according to the corresponding instruction message; The second sending module is used to send the preset service to the user end.
9. An electronic device, characterized in that: include: A processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method according to any one of claims 1 to 5 or the method according to any one of claims 6 to 7.
10. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented or the method according to any one of claims 6 to 7 is executed.