Communication method and system, electronic equipment and storage medium
By generating the Key code and ID code based on the SCPI instruction, the problem of inconsistent parameter definitions between different devices and versions in the field of test and measurement is solved, unique identification and standardized communication are realized, and the scalability and maintainability of the system are improved.
Patent Information
- Application Number
- CN202411766189.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-07
AI Technical Summary
In the field of test measurement, there is a lack of unified parameter or functional definitions between different programmable test measurement instruments and software versions, resulting in problem such as parameter conflicts and duplication.
By generating a Key code and ID code based on SCPI instructions, it is used to identify the target service content and the target device identity, so as to synchronize and request the communication protocol between the user interaction presenting end and the service logic processing end.
Ensure the uniqueness of each requested or synchronized content, avoid possible conflicts in multi-product integration and version management, improve system scalability and maintainability, simplify integration between different modules, and reduce development and maintenance costs.
Smart Images

Figure CN119583573A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of measurement technology, and in particular to a communication method and system, an electronic device and a storage medium. Background Art
[0002] At present, in the field of test and measurement, many programmable test and measurement instruments (referred to as products), such as oscilloscopes, signal sources, real-time spectrum analyzers (RTSA), etc., support SCPI (Standard Commands for Programmable Instruments). SCPI defines a set of standard syntax, command structure and data format for controlling programmable test and measurement instruments, and is an important command set for the development of programmable test and measurement instruments.
[0003] However, there is a lack of uniformity in parameter or function definitions among different products or software versions, which may lead to parameter conflicts and duplications, for example, during communication between UI (User interface) applications and different business modules or during maintenance between different software versions. Summary of the invention
[0004] In view of this, embodiments of the present application provide a communication method and system, an electronic device, and a storage medium to solve at least one problem existing in the background technology.
[0005] In a first aspect, an embodiment of the present application provides a communication method, the communication method comprising:
[0006] At least according to the command part of the SCPI instruction, a Key code is generated to identify the target service content; the Key code is at least used for the communication protocol between the user interaction presentation end and the service logic processing end in a synchronous situation;
[0007] At least based on the Key code, an ID code is generated to identify the identity of the target device; the ID code is at least used for the communication protocol between the user interaction presentation end and the business logic processing end under the request situation.
[0008] In combination with the first aspect, in an optional implementation,
[0009] The step of generating an ID code at least according to the Key code comprises:
[0010] Based on the string conversion algorithm, the Key code is converted into an ID code.
[0011] In combination with the first aspect, in an optional implementation,
[0012] In the request situation, the request message sent by the user interaction presentation end to the business logic processing end includes the ID code and the SCPI instruction; the response message sent by the business logic processing end to the user interaction presentation end includes the ID code and the processing result corresponding to the SCPI instruction;
[0013] And / or, in the synchronization situation, the synchronization message sent by the business logic processing end to the user interaction presentation end includes the Key code and a parameter value corresponding to the Key code.
[0014] In a second aspect, an embodiment of the present application provides a communication method, the communication method comprising:
[0015] The user interaction presentation terminal obtains the SCPI request instruction and obtains an ID code corresponding to the SCPI request instruction; the ID code is obtained at least according to the command part of the SCPI request instruction;
[0016] Based on the communication protocol including the ID code, the user interaction presentation end and the service logic processing end communicate with each other, so that the service logic processing end executes the target service content indicated by the SCPI request instruction and returns the processing result after execution to the user interaction presentation end;
[0017] The user interaction presentation end updates the interface according to the processing result.
[0018] In conjunction with the second aspect, in an optional implementation,
[0019] The communication protocol including the ID code is used to communicate between the user interaction presentation end and the service logic processing end, so that the service logic processing end executes the target service content indicated by the SCPI request instruction and returns the processing result after execution to the user interaction presentation end, including:
[0020] The user interaction presentation end sends a request message to the business logic processing end; the request message includes the ID code and the SCPI request instruction;
[0021] The user interaction presentation end obtains a response message sent by the business logic processing end in response to the request message; the response message includes the ID code and a processing result obtained by the business logic processing end after executing the target business content indicated by the SCPI request instruction.
[0022] In a third aspect, an embodiment of the present application provides a communication method, the communication method comprising:
[0023] The business logic processing end obtains the SCPI synchronization instruction and obtains a Key code corresponding to the SCPI synchronization instruction; the Key code is obtained at least according to the command part of the SCPI synchronization instruction;
[0024] Based on the communication protocol including the Key code, the user interaction presentation end and the business logic processing end communicate with each other, so that the user interaction presentation end updates the interface according to the update content indicated by the SCPI synchronization instruction.
[0025] In conjunction with the third aspect, in an optional implementation,
[0026] The communication protocol including the Key code is used to communicate between the user interaction presentation end and the business logic processing end, so that the user interaction presentation end performs an interface update according to the update content indicated by the SCPI synchronization instruction, including:
[0027] The business logic processing end sends a synchronization message including the Key code and update content corresponding to the SCPI synchronization instruction to the user interaction presentation end, so that the user interaction presentation end performs interface update according to the update content.
[0028] In a fourth aspect, an embodiment of the present application provides a communication system, the communication system comprising a user interaction presentation terminal;
[0029] The user interaction presentation end comprises:
[0030] A request instruction acquisition module, used to acquire a SCPI request instruction and obtain an ID code corresponding to the SCPI request instruction; the ID code is obtained at least according to a command part of the SCPI request instruction;
[0031] A request message sending module, used for sending a request message to the business logic processing end; the request message includes the ID code and the SCPI request instruction;
[0032] A response message acquisition module, used to acquire a response message sent by the service logic processing end in response to the request message; the response message includes the ID code and a processing result obtained after the service logic processing end executes the target service content indicated by the SCPI request instruction;
[0033] The request instruction parsing module is used to update the interface according to the processing result.
[0034] In conjunction with the fourth aspect, in an optional implementation manner, the communication system further includes a service logic processing end;
[0035] The business logic processing end includes:
[0036] A synchronization instruction acquisition module, used to acquire a SCPI synchronization instruction and obtain a Key code corresponding to the SCPI synchronization instruction; the Key code is obtained at least according to a command part of the SCPI synchronization instruction;
[0037] A synchronization message sending module, used for sending a synchronization message including the Key code and the update content corresponding to the SCPI synchronization instruction to the user interaction presentation end, so that the user interaction presentation end performs an interface update according to the update content;
[0038] The user interaction presentation end also includes:
[0039] A synchronization message acquisition module, used to acquire the synchronization message sent by the business logic processing end;
[0040] The synchronization instruction parsing module is used to update the interface according to the update content.
[0041] In a fifth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:
[0042] a memory storing instructions; and
[0043] A processor configured to execute the instructions to implement at least one of the following: the communication method as described in the first aspect; the communication method as described in the second aspect; the communication method as described in the third aspect.
[0044] In the sixth aspect, an embodiment of the present application provides a storage medium, characterized in that a computer program is stored in the storage medium, and when the computer program is executed, it can implement at least one of the following: the communication method as described in the first aspect; the communication method as described in the second aspect; the communication method as described in the third aspect.
[0045] The beneficial effects of the technical solution provided by the embodiment of the present application include: since the ID code and Key code used are generated by SCPI instructions (SCPI Command), the uniqueness of each request content or synchronization content can be ensured, the problem of non-uniqueness of identification using serviceid, messageid, and extra is solved, and conflicts that may occur in multi-product integration and version management are avoided. And by setting the communication protocol including the ID code in the request process, it is possible to determine that the only target device obtains instructions and responds to requests; by setting the communication protocol including the Key code in the synchronization process, it is possible to determine the only target business content, that is, it is possible to adopt SCPI instructions and provide a standardized way to form a communication protocol to standardize the request and synchronization process between the user interaction presentation end and the business logic processing end, which not only improves the scalability and maintainability of the system, but also simplifies the integration between different modules. And through SCPI instructions, the system can more flexibly define and expand the command set to adapt to different business needs and scenarios. The communication between the user interaction presentation end and the business logic processing end is also clearer and simpler, reducing the adaptation workload and improving development efficiency. Then, not only the development and maintenance costs are reduced, but also the standardized instructions reduce errors and redundancies, improve the reliability and consistency of the system, and provide better support for future expansion and maintenance.
[0046] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below and in part will become apparent from the description below or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The drawings are not necessarily drawn to scale, and local features may be enlarged or reduced to more clearly show the details of the local features. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0048] Figure 1 A schematic diagram of a principle block diagram of a test and measurement system consistent with at least one embodiment of the present application;
[0049] Figure 2 A schematic diagram of the communication process between the user interaction presentation end and the business logic processing end in the related art;
[0050] Figure 3 A flowchart of a specific example of a communication method in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of a specific example of a process for generating a Key code and an ID code in an embodiment of the present application;
[0052] Figure 5 A flow chart of a communication method consistent with at least one embodiment of the present application;
[0053] Figure 6 A flowchart of a specific example of a communication method in an embodiment of the present application;
[0054] Figure 7 is a flow chart of another communication method consistent with at least one embodiment of the present application;
[0055] Figure 8 A flowchart of another specific example of the communication method in the embodiment of the present application;
[0056] Fig. 9 A schematic diagram of a specific example of a communication process between a user interaction presentation end and a business logic processing end in an embodiment of the present application;
[0057] Fig.10 A schematic diagram of a principle block diagram of a specific example of a communication system in an embodiment of the present application;
[0058] Fig.11 A schematic diagram of a principle block diagram of another specific example of a communication system in an embodiment of the present application;
[0059] Fig.12 A schematic diagram of a principle block diagram of a specific example of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the technical solutions and beneficial effects of the present application more obvious and easy to understand, the following is a detailed description by listing specific embodiments. The drawings are not necessarily drawn to scale, and local features may be enlarged or reduced to more clearly show the details of the local features; unless otherwise defined, the technical and scientific terms used herein have the same meanings as those in the technical field to which the present application belongs.
[0061] The embodiments of the present application are not exhaustive, but are only illustrative of some embodiments, and are not intended to be a specific limitation on the scope of protection of the present application. In the absence of contradiction, each step in a certain embodiment can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, in a certain embodiment, the solution after removing some steps can also be implemented as an independent embodiment, and the order of the steps in a certain embodiment can be arbitrarily exchanged. In addition, the optional implementations in a certain embodiment can be arbitrarily combined; in addition, the embodiments can be arbitrarily combined, for example, some or all of the steps of different embodiments can be arbitrarily combined, and a certain embodiment can be arbitrarily combined with the optional implementations of other embodiments.
[0062] In each embodiment of the present application, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between the embodiments are consistent and can be referenced to each other. The technical features in different embodiments can be combined to form a new embodiment based on their internal logical relationships.
[0063] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application.
[0064] In the embodiments of the present application, unless otherwise specified, elements expressed in the singular form, such as "a", "an", "the", "above", "said", "aforementioned", "this", etc., may mean "one and only one", or "one or more", "at least one", etc. For example, when using articles such as "a", "an", "the" in English in translation, the noun after the article may be understood as a singular expression or a plural expression.
[0065] In the embodiments of the present application, "plurality" refers to two or more.
[0066] In some embodiments, the terms "at least one", "one or more", "aplurality of", "multiple", etc. can be used interchangeably.
[0067] The prefixes such as "first" and "second" in the embodiments of the present application are only used to distinguish different description objects, and do not constitute restrictions on the position, order, priority, value or content of the description objects. The statement of the description object refers to the description in the context of the claims or embodiments, and should not constitute unnecessary restrictions due to the use of prefixes. For example, the numerical value of the description object is not limited by the ordinal number, and can be one or more. Take "first device" as an example, where the numerical value of "device" can be one or more. In addition, the objects modified by different prefixes can be the same or different. For example, if the description object is "device", the "first device" and the "second device" can be the same device or different devices, and their types can be the same or different.
[0068] In some embodiments, the term "connection" may indicate that an electrical signal or data is transmitted between a connected end and a connected end, and may be understood as "electrical connection", "communication connection", etc. "Connection" may be a direct connection between two components, an indirect connection established through other components, internal communication between two components, or any other possible connection form.
[0069] This specification provides method operation steps such as embodiments or flow charts, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device, system or server product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).
[0070] Figure 1 The schematic diagram of the principle block diagram of a test and measurement system consistent with at least one embodiment of the present application is shown. As shown in the figure, the test and measurement system 100 may include a main device 101 and a plurality of peripheral devices 102 .
[0071] In some examples, the main device 101 and the multiple peripheral devices 102 can be multiple independent devices, such as multiple peripheral devices such as an oscilloscope, a signal generator, and a spectrum analyzer controlled by a computer. The computer can have one or more processors, and each of the multiple peripheral devices can have one or more processors.
[0072] In other examples, the main device 101 and the multiple peripheral devices 102 can be a single device, such as a PXI chassis product, including a PXI controller and multiple PXI interface modules, which can be connected through PCI Express, PCI, cPCI Express and other standard boards and multiple slots. These modules can be modules with functions such as oscilloscopes, signal generators, and spectrum analyzers. The PXI controller can have one or more processors, and each module can have one or more processors.
[0073] In the above example, the main device 101 may also be a test device, such as an oscilloscope. For example, the test and measurement system 100 may be a hybrid oscilloscope, including an oscilloscope and a logic analyzer, for simultaneously acquiring, displaying and analyzing analog signals and digital signals.
[0074] refer to Figure 1 The main device 101 may be a device controller, and may include at least one processor, a memory, at least one input interface and a communication interface, and may also include a user interface UI.
[0075] In some possible implementations, the processor may be a circuit with signal processing capabilities. In one implementation, the processor may be a circuit with instruction reading and execution capabilities, such as a central processing unit (CPU), a microprocessor, a graphics processing unit (GPU) (which can be understood as a microprocessor), or a digital signal processor (DSP), etc.; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the above hardware circuit is fixed or reconfigurable, such as a processor that is a hardware circuit implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the triggering device function. In addition, the processor can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as a neural network processing unit (NPU), a tensor processing unit (TPU), a deep learning processing unit (DPU), etc.
[0076] The memory may be used to store code to be executed by one or more processors and any data received by the device. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium may store an operating system and a computer program. The internal memory may provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium.
[0077] The input interface may be used to receive data, such as data from a test probe or a signal generator.
[0078] The communication interface may be used to communicate with the peripheral device 102 or other terminals.
[0079] refer to Figure 1 When the UI application communicates with different business modules (or peripherals), that is, the user interaction presentation end and the business logic processing end, it is usually necessary to identify the request content or synchronization content such as parameters or functions. The request content and synchronization content can be collectively referred to as business content. For example, Figure 2A schematic diagram of the communication process between the user interaction presentation end and the business logic processing end in the related art is shown. As shown in the figure, serviceid, messageid, extra, etc. are usually used to identify a certain parameter or function. However, this identification method is not unique, resulting in the inability to uniquely identify the parameter or function in different products (i.e., devices) or software versions, which will cause identification and adaptation problems in multi-product integration and version management, affecting the stability and maintainability of the system.
[0080] This non-uniqueness is particularly evident in the following two cases:
[0081] In one example, this may result in conflicts between different products (eg, product A and product B).
[0082] Product A: The configuration in product A is serviceid=1, messageid=100, extra=1, representing parameter 1.
[0083] Product B: The configuration in product B is serviceid=1, messageid=100, extra=1, representing parameter 2.
[0084] It can be seen that in integrated products such as PXI, when product A and product B are integrated at the same time, the same serviceid, messageid, and extra combination cannot uniquely identify a parameter, resulting in parameter conflicts and identification errors.
[0085] In another example, a conflict may occur between different software versions (eg, software version 1 and software version 2) of the same product.
[0086] Software version 1: The configuration in software version 1 is serviceid=1, messageid=100, extra=1, representing parameter 1.
[0087] Software version 2: The configuration in software version 2 is serviceid=1, messageid=100, extra=1, representing parameter 2.
[0088] It can be seen that the UI software needs to be adapted according to the version of the business software. Otherwise, the same serviceid, messageid, and extra combination may lead to parameter recognition errors in different versions, increasing the complexity of maintenance and adaptation.
[0089] To this end, an embodiment of the present application provides a communication method that can be applied to the communication between the user interaction presentation end and the business logic processing end in the above-mentioned test and measurement system. Figure 3A flow chart of a specific example of a communication method in an embodiment of the present application is shown. As shown in the figure, the communication method includes:
[0090] S101: Generate a Key code at least according to the command part of the SCPI instruction to identify the target service content; the Key code is at least used for the communication protocol between the user interaction presentation end and the service logic processing end in a synchronous situation;
[0091] S102: Generate an ID code at least based on the Key code to identify the target device; the ID code is at least used for the communication protocol between the user interaction presentation end and the business logic processing end in the request situation.
[0092] In an embodiment of the present application, in a request scenario, the communication protocol between the user interaction presentation end and the business logic processing end contains at least the ID code; in a synchronization scenario, the communication protocol between the user interaction presentation end and the business logic processing end contains at least the Key code.
[0093] Thus, in the embodiment of the present application, since the ID code and Key code used are generated by SCPI instructions (SCPI Command), the uniqueness of each request content or synchronization content can be ensured, which solves the problem that the use of serviceid, messageid, and extra for identification is not unique, and avoids conflicts that may occur in multi-product integration and version management. And by setting the communication protocol including the ID code in the request process, it is possible to determine that the only target device obtains instructions and responds to requests; by setting the communication protocol including the Key code in the synchronization process, it is possible to determine the only target business content, that is, it is possible to adopt SCPI instructions and provide a standardized way to form a communication protocol to standardize the request and synchronization process between the user interaction presentation end and the business logic processing end, which not only improves the scalability and maintainability of the system, but also simplifies the integration between different modules. And through SCPI instructions, the system can more flexibly define and expand the command set to adapt to different business needs and scenarios. The communication between the user interaction presentation end and the business logic processing end is also clearer and simpler, reducing the adaptation workload and improving development efficiency. Then, not only the development and maintenance costs are reduced, but also the standardized instructions reduce errors and redundancies, improve the reliability and consistency of the system, and provide better support for future expansion and maintenance.
[0094] In an exemplary embodiment, a SCPI command may include at least one of the following: uppercase letter commands (keywords); mixed uppercase and lowercase letter commands; curly brackets "{}"; vertical lines "|"; angle brackets "<>"; square brackets "[]"; colon ":"; question mark "?"; and the like.
[0095] Most commands can be a mixture of uppercase and lowercase letters, or can be abbreviations that use uppercase letters to represent commands. Curly braces can contain optional parameters. Vertical lines can separate optional parameters. Angle brackets can list parameter values, i.e. parameter options. Square brackets can contain optional parameters. Colons can separate command keywords from the next level of keywords. Question marks can indicate query functions.
[0096] Then, the SCPI instruction may include a command part and a symbol part. The command part may include at least one of the following: a keyword in uppercase letters; a keyword in a mixture of uppercase letters and lowercase letters. The symbol part may include at least one of the following: curly brackets "{}"; vertical line "|"; angle brackets "<>"; square brackets "[]"; colon ":"; question mark "?"; and so on.
[0097] As a specific example, the SCPI command may be:
[0098] :TIMebase[:MAIN]:SCALe?
[0099] Used to query the gear position of the main time base.
[0100] In an exemplary embodiment, the command part of the SCPI instruction may be used to generate a Key code, which may be:
[0101] TIMEBASE_MAIN_SCALE
[0102] The specific method to generate the above key code is: remove the initial colon, square brackets and question mark, replace the middle colon with an underscore, and capitalize all letters.
[0103] In another exemplary embodiment, the command part and the symbol part of the SCPI instruction may be used to jointly generate a Key code, which may be:
[0104] :TIMebase:MAIN:SCALe
[0105] The specific method to generate the above Key code is: remove the square brackets and question marks.
[0106] Then, the SCPI instruction can be formatted according to the command part of the SCPI instruction; or according to the command part and the symbol part of the SCPI instruction, that is, at least according to the command part of the SCPI instruction, to generate a Key code, which can be set according to actual needs. The Key code generated in this way can be used to uniquely identify the request content or synchronization content corresponding to the SCPI instruction, that is, the target business content. Among them, the request content can represent the content queried or configured by the user interaction presentation end to the business logic processing end, and the synchronization content can represent the content synchronized by the business logic processing end to the user interaction presentation end.
[0107] The following are some specific examples of how to format the Key code using SCPI commands:
[0108] Example 1:
[0109] :TIMebase[:MAIN]:SCALe <scale>, used to set the gear of the main time base;
[0110] :TIMebase[:MAIN]:SCALe?, used to query the gear position of the main time base;
[0111] After formatting, we get:
[0112] TIMebase_MAIN_SCALe
[0113] Example 2:
[0114] :MATH <n>:DISPlay <bool>, used to turn on or off the mathematical operation function;
[0115] :MATH <n>:DISPlay?, used to query the status of the math function;
[0116] After formatting, we get:
[0117] :MATH <n>:DISPlay
[0118] Example 3:
[0119] :TRIGger:PATTern:PATTern <pch1> [, <pch2> [, <pch3> [, <pch4>]]], used to set the code pattern of each channel when the code pattern is triggered;
[0120] :TRIGger:PATTern:PATTern?, used to query the pattern of each channel during pattern triggering;
[0121] After formatting, we get:
[0122] :TRIGger:PATTern:PATTern, or
[0123] TRIGger_PATTern_PATTern, or
[0124] TRIGGER_PATTERN_PATTERN.
[0125] Figure 4 A flow chart of a specific example of generating a Key code and an ID code in an embodiment of the present application is shown. As shown in the figure, in an exemplary embodiment, a specific method of formatting a SCPI instruction to generate a Key code may include at least one of the following:
[0126] Remove the angle brackets (<>) and the content in the angle brackets;
[0127] Remove the colon (:) at the beginning of the string;
[0128] Replace the colon (:) in the middle with an underscore (_).
[0129] Remove all existing symbols, including commas (,), curly braces ({}), question marks (?), spaces, and asterisks (*);
[0130] Convert all characters to uppercase.
[0131] In a preferred embodiment, when the SCPI command is formatted to generate the Key code, all the above items are modified.
[0132] In an optional implementation manner, the step S102 of generating an ID code at least according to the Key code includes:
[0133] S1021: Based on a character string conversion algorithm, convert the Key code into an ID code.
[0134] In the embodiment of the present application, by adopting a string conversion algorithm, it can be ensured that a unique ID code is obtained through the Key code conversion; other algorithms can also be used, for example, providing a custom encryption function, inputting a string (Key code), and returning a unique number (ID code); or adopting a hash algorithm; or adopting other encoding algorithms, such as label encoding, etc.; the Key code can also be combined with other strings to generate an ID code to improve uniqueness, which can be set according to actual needs.
[0135] In the embodiment of the present application, a hash algorithm (also known as hash coding, Hashing) is a fast method for converting a string into an integer. The hash function maps each string to a unique integer. Hash coding can usually convert a large amount of string data into a digital representation. By using a hash algorithm, not only can a unique ID code be obtained according to the SCPI instruction, but also the operation efficiency can be improved.
[0136] Taking the SCPI command ":TIMebase[:MAIN]:SCALe?" as an example, the Key code "TIMEBASE_MAIN_SCALE" can be obtained. Then, by using the hash algorithm to calculate the string "TIMEBASE_MAIN_SCALE", the ID code 1218920165 can be obtained.
[0137] In an optional implementation manner, in the request situation, the request message sent by the user interaction presentation end to the business logic processing end includes the ID code and the SCPI instruction; the response message sent by the business logic processing end to the user interaction presentation end includes the ID code and the processing result corresponding to the SCPI instruction;
[0138] And / or, in the synchronization situation, the synchronization message sent by the business logic processing end to the user interaction presentation end includes the Key code and a parameter value corresponding to the Key code.
[0139] In this way, the embodiment of the present application, through a request message including an ID code and a SCPI instruction, and a response message including an ID code and a processing result (such as a result value), can enable the unique target device corresponding to the ID code to execute the business content indicated by the SCPI instruction, and return the processing result to the user interaction presentation end to update the interface, thereby realizing the update of the unique target device corresponding to the ID code; through a synchronization message including a Key code and a parameter value, the unique interface element corresponding to the Key code can be found and updated, thereby improving the standardization of communication between the user interaction presentation end and the business logic processing end, thereby improving communication clarity and reducing possible conflicts.
[0140] The embodiment of the present application also provides a communication method, which can be applied to the communication request situation between the user interaction presentation end and the business logic processing end. Figure 5 A flow chart of a communication method consistent with at least one embodiment of the present application is shown. As shown in the figure, the communication method includes:
[0141] S201: The user interaction presentation terminal obtains a SCPI request instruction and obtains an ID code corresponding to the SCPI request instruction; the ID code is obtained at least according to a command part of the SCPI request instruction;
[0142] S202: Based on the communication protocol including the ID code, the user interaction presentation end and the service logic processing end communicate with each other, so that the service logic processing end executes the target service content indicated by the SCPI request instruction and returns the processing result after execution to the user interaction presentation end;
[0143] S203: The user interaction presentation end updates the interface according to the processing result.
[0144] In the embodiment of the present application, the method of obtaining the corresponding ID code according to the SCPI request instruction can be set according to actual needs. In one example, the conversion of the Key code and ID code corresponding to each SCPI instruction can be completed by initializing the device, and the conversion method can refer to the above-mentioned communication method; and after the conversion is completed, it is stored so that when the Key code and ID code corresponding to the specific SCPI request instruction are needed in the future, they can be obtained by query or other methods. In another example, every time a specific SCPI request instruction is obtained at the user interaction presentation end, the Key code and ID code corresponding to the SCPI request instruction can be converted and obtained, and the conversion method can refer to the above-mentioned communication method.
[0145] The SCPI request instruction may be a SCPI instruction used for communication between the user interaction presentation end and the service logic processing end during the request phase (ie, the request situation).
[0146] In this way, the embodiment of the present application performs communication between the user interaction presentation end and the business logic processing end based on a communication protocol including an ID code during the request phase. Since the ID code used is generated by an SCPI instruction (SCPI Command), the uniqueness of each request content can be ensured, avoiding conflicts that may occur in multi-product integration and version management. And by setting the communication protocol including the ID code in the request process, it is possible to determine that the only target device obtains instructions and responds to the request, that is, it is possible to use SCPI instructions and provide a standardized way to form a communication protocol to standardize the request process between the user interaction presentation end and the business logic processing end, thereby improving the scalability and maintainability of the system, simplifying the integration between different modules, reducing the workload of adaptation, improving development efficiency, reducing development and maintenance costs, improving the reliability and consistency of the system, and providing better support for future expansion and maintenance.
[0147] In an optional implementation manner, the communication between the user interaction presentation end and the service logic processing end based on the communication protocol including the ID code in step S202, so that the service logic processing end executes the target service content indicated by the SCPI request instruction and returns the processing result after execution to the user interaction presentation end, includes:
[0148] S2021: The user interaction presentation end sends a request message to the business logic processing end; the request message includes the ID code and the SCPI request instruction;
[0149] S2022: The user interaction presentation end obtains a response message sent by the business logic processing end in response to the request message; the response message includes the ID code and a processing result obtained by the business logic processing end after executing the target business content indicated by the SCPI request instruction.
[0150] In this way, the embodiment of the present application, through a request message including an ID code and a SCPI request instruction, and a response message including an ID code and a processing result (such as a result value), can enable the unique target device corresponding to the ID code to execute the target business content indicated by the SCPI request instruction, and return the processing result to the user interaction presentation end to update the interface, thereby realizing the update of the unique target device corresponding to the ID code, thereby improving the standardization of communication between the user interaction presentation end and the business logic processing end, thereby improving communication clarity and reducing possible conflicts.
[0151] In an exemplary embodiment, the format of the request message may be:
[0152] <id>,<SCPI Command>
[0153] But it is not limited to this and can be set according to actual needs.
[0154] The response message format can be:
[0155] <id> , <result>
[0156] But it is not limited to this and can be set according to actual needs.
[0157] Then, the request process in the request phase can include:
[0158] 1. The user interaction presentation end sends a request, specifically: the user interaction presentation end passes <id>,<SCPI Command> The request message is sent to the business logic processing end in the specified format.
[0159] 2. The business logic processing end processes the request. Specifically, after receiving the request message, the business logic processing end finds the corresponding processing function by parsing the SCPI Command.
[0160] 3. Return result: After the business logic processing end processes the request message, such as after executing the processing function, <id> , <result>The response message is sent in the format to return the result to the user interaction presentation end.
[0161] In an example, a specific implementation according to the above request process may be:
[0162] The user interaction presentation end sends a request: 1218920165,TIMebase:MAIN:SCALe?.
[0163] The business logic processing end processes the request: find and execute the CApiHorizontal:ApiHorizontal_SetMainScale() function through TIMebase:MAIN:SCALe?.
[0164] Return result: 1218920165,1.
[0165] Figure 6 A flow chart of a specific example of a communication method in an embodiment of the present application is shown. As shown in the figure, in an optional implementation, the communication method further includes:
[0166] S204: The business logic processing end creates a server and listens to a port;
[0167] S205: The user interaction presentation end sends a connection request to the business logic processing end;
[0168] S206: The business logic processing end receives the connection request and establishes a connection with the user interaction presentation end;
[0169] S207: The user interaction presentation end starts a child thread to asynchronously poll and read content.
[0170] In this way, through steps S204 to S207, applied in the data request phase, a connection between the user interaction presentation end and the business logic processing end is established, and it is possible to continuously monitor whether the SCPI request instruction is obtained and respond in time.
[0171] The embodiment of the present application also provides a communication method, which can be applied to the synchronization situation of communication between the user interaction presentation end and the business logic processing end. Figure 7 A flow chart of another communication method consistent with at least one embodiment of the present application is shown. As shown in the figure, the communication method includes:
[0172] S301: The service logic processing end obtains a SCPI synchronization instruction and obtains a Key code corresponding to the SCPI synchronization instruction; the Key code is obtained at least according to a command part of the SCPI synchronization instruction;
[0173] S302: Based on the communication protocol including the Key code, the user interaction presentation end and the business logic processing end communicate with each other, so that the user interaction presentation end updates the interface according to the update content indicated by the SCPI synchronization instruction.
[0174] In the embodiment of the present application, the method of obtaining the corresponding Key code according to the SCPI synchronization instruction can be set according to actual needs. In one example, the conversion of the Key code and ID code corresponding to each SCPI instruction can be completed by initializing the device, and the conversion method can refer to the above-mentioned communication method; and after the conversion is completed, it is stored so that when the Key code and ID code corresponding to the specific SCPI synchronization instruction are needed in the future, they can be obtained by query or other methods. In another example, every time a specific SCPI synchronization instruction is obtained at the business logic processing end, the Key code and ID code corresponding to the SCPI synchronization instruction can be converted and obtained, and the conversion method can refer to the above-mentioned communication method.
[0175] The SCPI synchronization instruction may be a SCPI instruction used for communication between the user interaction presentation end and the service logic processing end during the synchronization phase (ie, the synchronization situation).
[0176] In this way, the embodiment of the present application performs communication between the user interaction presentation end and the business logic processing end based on the communication protocol including the Key code during the synchronization phase. Since the Key code used is generated by the SCPI instruction (SCPI Command), the uniqueness of each synchronization content can be ensured, avoiding conflicts that may occur in multi-product integration and version management. And by setting the communication protocol including the Key code in the synchronization process, the unique target business content can be determined, that is, the SCPI instruction can be used and a standardized method can be provided to form the communication protocol to standardize the synchronization process between the user interaction presentation end and the business logic processing end, thereby improving the scalability and maintainability of the system, simplifying the integration between different modules, reducing the adaptation workload, improving development efficiency, reducing development and maintenance costs, improving the reliability and consistency of the system, and providing better support for future expansion and maintenance.
[0177] In an optional implementation, the communication between the user interaction presentation end and the business logic processing end based on the communication protocol including the Key code in step S302, so that the user interaction presentation end performs an interface update according to the update content indicated by the SCPI synchronization instruction, includes:
[0178] S3021: The business logic processing end sends a synchronization message including the Key code and update content corresponding to the SCPI synchronization instruction to the user interaction presentation end, so that the user interaction presentation end updates the interface according to the update content.
[0179] In the embodiment of the present application, the update content corresponding to the SCPI synchronization instruction may be a parameter value to be synchronously updated, or other values.
[0180] In this way, the embodiment of the present application can find and update the unique interface element corresponding to the SCPI synchronization instruction or Key code through the synchronization message including the Key code and the update content (such as the parameter value), thereby improving the standardization of communication between the user interaction presentation end and the business logic processing end, thereby improving the clarity of communication and reducing possible conflicts.
[0181] In an exemplary embodiment, the format of the synchronization message may be:
[0182] <key> <value>
[0183] But it is not limited to this and can be set according to actual needs.
[0184] Then, the synchronization process in the synchronization phase may include:
[0185] 1. Business logic processing end synchronization content, specifically: Business logic processing end through <key> <value>The format sends synchronization messages to the user interaction presentation end to synchronize the content.
[0186] 2. The user interaction presentation end updates the interface. Specifically, after receiving the synchronization message, the user interaction presentation end finds the corresponding interface element through the Key code and updates it.
[0187] In an example, a specific implementation of the above synchronization process may be:
[0188] Business logic processing end synchronization content: TIMEBASE_MAIN_SCALE 0.5
[0189] Update the interface of the user interaction presentation end: find the menu interface through TIMEBASE_MAIN_SCALE and update the corresponding parameter value to 0.5.
[0190] Figure 8 A flow chart of another specific example of the communication method in the embodiment of the present application is shown. As shown in the figure, in an optional implementation manner, the communication method further includes:
[0191] S303: The user interaction presentation end creates a server and listens to a port;
[0192] S304: The business logic processing end sends a connection request to the user interaction presentation end;
[0193] S305: The user interaction presentation end receives the connection request and establishes a connection with the business logic processing end;
[0194] S306: The business logic processing end starts a child thread to asynchronously poll and read content.
[0195] In this way, through steps S303 to S306, a connection between the user interaction presentation end and the business logic processing end is established, and it is possible to continuously monitor whether the SCPI synchronization instruction is obtained and respond in time.
[0196] Fig. 9 The schematic diagram shows a specific example of the communication process between the user interaction presentation end and the business logic processing end in the embodiment of the present application. As shown in the figure, the request process is as follows: the UI process sends a request to the business process <id> , <scpicommand>; The business process processes the request; The business process returns the result to the UI process <id> , <result>This enables the UI front-end to query or configure the business back-end.
[0197] The specific synchronization process is: the business process synchronizes content to the UI process <key> <value>; UI process updates the interface. This achieves synchronization from the business backend to the UI frontend (such as parameter synchronization).
[0198] The present application also provides a communication system. Fig.10 A schematic diagram of a principle block diagram of a specific example of a communication system in an embodiment of the present application is shown. As shown in the figure, the communication system includes a user interaction presentation terminal;
[0199] The user interaction presentation end comprises:
[0200] A request instruction acquisition module, used to acquire a SCPI request instruction and obtain an ID code corresponding to the SCPI request instruction; the ID code is obtained at least according to a command part of the SCPI request instruction;
[0201] A request message sending module, used for sending a request message to the business logic processing end; the request message includes the ID code and the SCPI request instruction;
[0202] A response message acquisition module, used to acquire a response message sent by the service logic processing end in response to the request message; the response message includes the ID code and a processing result obtained after the service logic processing end executes the target service content indicated by the SCPI request instruction;
[0203] The request instruction parsing module is used to update the interface according to the processing result.
[0204] Fig.11 A schematic diagram of a principle block diagram of another specific example of a communication system in an embodiment of the present application is shown. As shown in the figure, in an optional implementation, the communication system further includes a service logic processing terminal;
[0205] The business logic processing end includes:
[0206] A synchronization instruction acquisition module, used to acquire a SCPI synchronization instruction and obtain a Key code corresponding to the SCPI synchronization instruction; the Key code is obtained at least according to a command part of the SCPI synchronization instruction;
[0207] A synchronization message sending module, used for sending a synchronization message including the Key code and the update content corresponding to the SCPI synchronization instruction to the user interaction presentation end, so that the user interaction presentation end performs an interface update according to the update content;
[0208] The user interaction presentation end also includes:
[0209] A synchronization message acquisition module, used to acquire the synchronization message sent by the business logic processing end;
[0210] The synchronization instruction parsing module is used to update the interface according to the update content.
[0211] In this way, the embodiment of the present application communicates between the user interaction presentation end and the business logic processing end through a communication protocol including an ID code in the request phase and a communication protocol including a Key code in the synchronization phase. Since the Key code and ID code used are generated by SCPI instructions (SCPI Command), the uniqueness of each request and synchronization content can be ensured, avoiding conflicts that may arise in multi-product integration and version management. That is, SCPI instructions can be used and a communication protocol can be formed in a standardized manner to standardize the request and synchronization process between the user interaction presentation end and the business logic processing end, thereby improving the scalability and maintainability of the system, simplifying the integration between different modules, reducing the adaptation workload, improving development efficiency, reducing development and maintenance costs, improving the reliability and consistency of the system, and providing better support for future expansion and maintenance.
[0212] In an optional implementation manner, at least one of the user interaction presentation end and the business logic processing end further includes:
[0213] A first generating module is used to generate a Key code for identifying a target service content according to at least a command part of the SCPI instruction; the Key code is used at least for a communication protocol between a user interaction presentation end and a service logic processing end in a synchronous situation;
[0214] The second generating module is used to generate an ID code at least according to the Key code to identify the identity of the target device; the ID code is at least used for the communication protocol between the user interaction presentation end and the business logic processing end under the request situation.
[0215] Regarding the above-mentioned device embodiment, the specific manner in which each module (for example, a request instruction acquisition module, a request message sending module, a response message acquisition module, a request instruction parsing module, a synchronization instruction acquisition module, a synchronization message sending module, a synchronization message acquisition module, and a synchronization instruction parsing module) performs operations and the technical effects can be referred to the corresponding description in the above-mentioned method embodiment and will not be elaborated here.
[0216] It should be understood that the division of the units or modules in the above devices is only a division of logical functions, and in actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. In addition, the units or modules in the device can be implemented in the form of a processor calling software: for example, the device includes a processor, the processor is connected to a memory, the memory stores instructions, and the processor calls the instructions stored in the memory to implement any of the above methods or implement the functions of the units or modules of the above devices.
[0217] An embodiment of the present application also provides an electronic device that can be applied to any device in the above-mentioned test and measurement system. Fig.12 A schematic diagram of a principle block diagram of a specific example of an electronic device in an embodiment of the present application is shown. As shown in the figure, the electronic device includes:
[0218] a memory storing instructions; and
[0219] A processor is configured to execute the instructions to implement the communication method as described in the above embodiment.
[0220] like Fig.12 As shown, the electronic device may include a processor, a memory, a network interface, a display, and an input device connected via a system bus. The processor may be used to provide computing and control capabilities. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium may store an operating system and a computer program. The internal memory may provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface may be used to communicate with an external terminal via a network connection. The display may be a liquid crystal display or an electronic ink display. The input device may be a touch layer covered on the display, or a button, trackball, or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad, or mouse, etc.
[0221] Those skilled in the art will understand that Fig.12 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0222] The present application also provides a computer-readable storage medium in which a computer program is stored. When the computer program is executed, the corresponding functions described in the above method embodiment can be implemented. The computer program can also be stored in a computer-readable storage medium such as Fig.12 The memory of the electronic device contains various program modules constituting the above communication system, and the computer program composed of the various program modules can realize the functions corresponding to the various steps in the communication method described in the above embodiment when executed.
[0223] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the electronic device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the electronic device executes the communication method provided in the above various implementations.
[0224] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. Among them, any reference to memory, storage, database or other medium used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0225] It should be understood that the above embodiments are exemplary and are not intended to include all possible implementations included in the claims. Various modifications and changes may be made on the basis of the above embodiments without departing from the scope of the present disclosure. Similarly, the various technical features of the above embodiments may be arbitrarily combined to form other embodiments of the present application that may not be explicitly described. Therefore, the above embodiments only express several implementations of the present application and do not limit the scope of protection of the patent of this application.< / value> < / key> < / result> < / id> < / scpicommand> < / id> < / value> < / key> < / value> < / key> < / result> < / id> < / id> < / result> < / id> < / id> < / pch3> < / pch2> < / pch1> < / n> < / n> < / bool> < / n> < / scale>
Claims
1. A communication method, characterized in that: The communication method comprises: At least according to the command part of the SCPI instruction, a Key code is generated to identify the target service content; the Key code is at least used for the communication protocol between the user interaction presentation end and the service logic processing end in a synchronous situation; At least based on the Key code, an ID code is generated to identify the identity of the target device; the ID code is at least used for the communication protocol between the user interaction presentation end and the business logic processing end under the request situation.
2. The communication method according to claim 1, characterized in that: The step of generating an ID code at least according to the Key code comprises: Based on the string conversion algorithm, the Key code is converted into an ID code.
3. The communication method according to claim 1 or 2, characterized in that: In the request situation, the request message sent by the user interaction presentation end to the business logic processing end includes the ID code and the SCPI instruction; the response message sent by the business logic processing end to the user interaction presentation end includes the ID code and the processing result corresponding to the SCPI instruction; And / or, in the synchronization situation, the synchronization message sent by the business logic processing end to the user interaction presentation end includes the Key code and a parameter value corresponding to the Key code.
4. A communication method, characterized in that: The communication method comprises: The user interaction presentation terminal obtains the SCPI request instruction and obtains an ID code corresponding to the SCPI request instruction; the ID code is obtained at least according to the command part of the SCPI request instruction; Based on the communication protocol including the ID code, the user interaction presentation end and the service logic processing end communicate with each other, so that the service logic processing end executes the target service content indicated by the SCPI request instruction and returns the processing result after execution to the user interaction presentation end; The user interaction presentation end updates the interface according to the processing result.
5. The communication method according to claim 4, characterized in that: The communication protocol including the ID code is used to communicate between the user interaction presentation end and the service logic processing end, so that the service logic processing end executes the target service content indicated by the SCPI request instruction and returns the processing result after execution to the user interaction presentation end, including: The user interaction presentation end sends a request message to the business logic processing end; the request message includes the ID code and the SCPI request instruction; The user interaction presentation end obtains a response message sent by the business logic processing end in response to the request message; the response message includes the ID code and a processing result obtained by the business logic processing end after executing the target business content indicated by the SCPI request instruction.
6. A communication method, characterized in that: The communication method comprises: The business logic processing end obtains the SCPI synchronization instruction and obtains a Key code corresponding to the SCPI synchronization instruction; the Key code is obtained at least according to the command part of the SCPI synchronization instruction; Based on the communication protocol including the Key code, the user interaction presentation end and the business logic processing end communicate with each other, so that the user interaction presentation end updates the interface according to the update content indicated by the SCPI synchronization instruction.
7. The communication method according to claim 6, characterized in that: The communication protocol including the Key code is used to communicate between the user interaction presentation end and the business logic processing end, so that the user interaction presentation end performs an interface update according to the update content indicated by the SCPI synchronization instruction, including: The business logic processing end sends a synchronization message including the Key code and update content corresponding to the SCPI synchronization instruction to the user interaction presentation end, so that the user interaction presentation end performs interface update according to the update content.
8. A communication system, characterized in that: The communication system includes a user interaction presentation terminal; The user interaction presentation end comprises: A request instruction acquisition module, used to acquire a SCPI request instruction and obtain an ID code corresponding to the SCPI request instruction; the ID code is obtained at least according to a command part of the SCPI request instruction; A request message sending module, used for sending a request message to the business logic processing end; the request message includes the ID code and the SCPI request instruction; A response message acquisition module, used to acquire a response message sent by the service logic processing end in response to the request message; the response message includes the ID code and a processing result obtained after the service logic processing end executes the target service content indicated by the SCPI request instruction; The request instruction parsing module is used to update the interface according to the processing result.
9. The communication system according to claim 8, characterized in that: The communication system also includes a business logic processing end; The business logic processing end includes: A synchronization instruction acquisition module, used to acquire a SCPI synchronization instruction and obtain a Key code corresponding to the SCPI synchronization instruction; the Key code is obtained at least according to a command part of the SCPI synchronization instruction; A synchronization message sending module, used for sending a synchronization message including the Key code and the update content corresponding to the SCPI synchronization instruction to the user interaction presentation end, so that the user interaction presentation end performs an interface update according to the update content; The user interaction presentation end also includes: A synchronization message acquisition module, used to acquire the synchronization message sent by the business logic processing end; The synchronization instruction parsing module is used to update the interface according to the update content.
10. An electronic device, characterized in that: The electronic device comprises: a memory storing instructions; and A processor configured to execute the instructions to implement at least one of the following: a communication method as described in any one of claims 1 to 3; a communication method as described in claim 4 or 5; a communication method as described in claim 6 or 7.
11. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed, can implement at least one of the following: the communication method as described in any one of claims 1 to 3; the communication method as described in claim 4 or 5; the communication method as described in claim 6 or 7.