Method for acquiring application service port number, electronic device, and chip
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-08-13
Smart Images

Figure CN2025133933_13082026_PF_FP_ABST
Abstract
Description
Methods, electronic devices, and chips for obtaining application service port numbers
[0001] This application claims priority to Chinese patent application filed on February 7, 2025, with application number 202510138520.7 and entitled "Method, electronic device and chip for obtaining application service port number", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of communication technology, and in particular to a method, electronic device, and chip for obtaining application service port numbers. Background Technology
[0003] Currently, the Sparklink Alliance provides a short-range wireless communication protocol (referred to as the Sparklink protocol) for short-range data transmission in application scenarios such as smart cars, smart homes, smart terminals, and smart manufacturing.
[0004] The StarSpeed protocol supports identifying various services (referred to as application services) within an application through port numbers. Examples include short-range data transmission, audio / video calls, and payment services in Application 1. Data is then sent to the peer device based on the port number to implement the relevant functions of the application service. During data transmission to the peer device, the application data packet must include the application service's port number on the local end (i.e., the source port number) and the application service's port number on the peer device (i.e., the destination port number). However, in an electronic device, the port numbers for some application services are typically assigned by the device itself, and electronic devices currently lack the ability to obtain the application service's port number on the peer device via the StarSpeed protocol. Therefore, a method for obtaining application service port numbers is urgently needed. Summary of the Invention
[0005] This application provides a method, electronic device, and chip for obtaining application service port numbers, which solves the problem in the prior art that electronic devices cannot obtain the port numbers of application services on the peer device through the StarFlash protocol.
[0006] In a first aspect, embodiments of this application provide a method for obtaining an application service port number, applied to a first electronic device, wherein the first electronic device and a second electronic device are connected via the StarSignal protocol. The method includes: sending a query message to the second electronic device through a target object in the StarSignal protocol, the target object including the StarSignal Service Interaction Protocol (SSAP) or a first well-known port, the application service using a dynamic port of the StarSignal protocol, and the query message being used to query the port number of the application service in the second electronic device; and receiving a query result from the second electronic device through the target object, the query result including the port number of the application service in the second electronic device.
[0007] The method provided in this application embodiment allows an electronic device to obtain the port number of the application service on the peer device via SSAP or a well-known port, and then send data to the application service on the peer device based on the port number.
[0008] In some embodiments, the query message is used to query the port attributes of all application services using dynamic ports in the second electronic device. The port attributes include a mapping relationship between Universal Unique Identifier (UUID) and port number. Accordingly, the query result includes the port attributes of all application services using dynamic ports in the second electronic device. Using the method provided in this application embodiment, the first electronic device can obtain all potentially usable port attributes with a single query, resulting in high query efficiency.
[0009] In some embodiments, the method further includes: receiving an attribute update notification from a second electronic device, the attribute update notification being used to notify the addition of port attributes for a second application service, or the deletion of port attributes for a third application service. This method can ensure the consistency of the second port attribute list on the first electronic device side and the second electronic device side, thereby ensuring the accuracy of data transmission.
[0010] In some embodiments, the query message includes the UUID of a first application service. The first application service uses a dynamic port, and the query message is used to query the port number of the first application service in the second electronic device. The query result includes the port number of the first application service in the second electronic device. That is, the first electronic device obtains only the port number of one application service at a time in the second electronic device according to the needs of the application service, enabling targeted acquisition of port numbers.
[0011] In some embodiments, when the target object is a first well-known port, the query message data packet includes the following:
[0012] The source port number is the port number of the first well-known port.
[0013] The destination port number is the port number of the most well-known port.
[0014] Message type identifier, corresponding to the service query message.
[0015] The UUID of the first application business.
[0016] In some embodiments, the data packet containing the query results includes the following:
[0017] The source port number is the port number of the first well-known port.
[0018] The destination port number is the port number of the most well-known port.
[0019] The message type identifier corresponds to the service query response.
[0020] The UUID of the first application business.
[0021] The first application service is located on the port number of the second electronic device.
[0022] In some embodiments, where the UUID of the first application service is an identifier generated by the application vendor, the query message also includes the vendor identity identifier of the first application service. This is because UUIDs randomly generated by different vendors have a high probability of being the same, although this probability is small. However, in order to accurately obtain the port number of the application service on the second electronic device, the first electronic device still needs to further determine the port number based on the vendor identity identifier of the application service.
[0023] In some embodiments, the method further includes: after the first electronic device disconnects from the Star Flash connection with the second electronic device, or after the first electronic device disables the Star Flash function, deleting the port number of the application service in the second electronic device to avoid occupying memory.
[0024] Secondly, embodiments of this application provide a method for obtaining an application service port number, applied to a second electronic device. The first and second electronic devices are connected via the StarSignal protocol. The method includes: receiving a query message from the first electronic device through a target object in the StarSignal protocol, the target object including the StarSignal Service Interaction Protocol (SSAP) or a first well-known port, the application service using a dynamic port of the StarSignal protocol, and the query message being used to query the port number of the application service in the second electronic device; and sending a query result to the second electronic device through the target object, the query result including the port number of the application service in the second electronic device.
[0025] In some embodiments, the query message is used to query the port attributes of all application services using the StarSpark protocol dynamic port in the second electronic device. The port attributes include the mapping relationship between the universally unique identifier (UUID) and the port number. The query result includes the port attributes of all application services using the StarSpark protocol dynamic port in the second electronic device.
[0026] In some embodiments, the method further includes: sending an attribute update notification to a first electronic device, the attribute update notification being used to notify of the addition of a port attribute of a second application service, or deleting a port attribute of a third application service.
[0027] In some embodiments, the query message includes the UUID of the first application service, used to query the port number of the first application service in the second electronic device; the query result includes the port number of the first application service in the second electronic device.
[0028] In some embodiments, when the target object is a first well-known port, the query message data packet includes the following:
[0029] The source port number is the port number of the first well-known port.
[0030] The destination port number is the port number of the most well-known port.
[0031] Message type identifier, corresponding to the service query message.
[0032] The UUID of the first application business.
[0033] In some embodiments, the data packet containing the query results includes the following:
[0034] The source port number is the port number of the first well-known port.
[0035] The destination port number is the port number of the most well-known port.
[0036] The message type identifier corresponds to the service query response.
[0037] The UUID of the first application business.
[0038] The first application service is located on the port number of the second electronic device.
[0039] In some embodiments, where the UUID of the first application service is an identifier generated by the application vendor, the query message may also include the vendor identity identifier of the first application service.
[0040] In some embodiments, before receiving a query message from the first electronic device through the target object in the StarFlash protocol, the method further includes: in response to the second electronic device activating the StarFlash function, the second electronic device generates port attributes for the application service according to the request of the application service, the port attributes including the mapping relationship between UUID and port number.
[0041] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the methods shown in the first or second aspect above.
[0042] Fourthly, embodiments of this application provide a chip including a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, implements the methods shown in the first or second aspect above.
[0043] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods shown in the first or second aspect above.
[0044] Sixthly, embodiments of this application provide a computer program product comprising a computer program that, when executed by an electronic device, causes the electronic device to implement the methods shown in the first and second aspects above.
[0045] It is understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0046] Figure 1 is a schematic diagram of a communication system applicable to the embodiments of this application;
[0047] Figure 2 is a schematic diagram of the software structure of an electronic device supporting the StarFlash protocol provided in an embodiment of this application;
[0048] Figure 3 is a schematic flowchart of the method for obtaining the application service port number provided in the embodiments of this application;
[0049] Figure 4 is a schematic diagram of a port number application process provided in an embodiment of this application;
[0050] Figure 5 is a flowchart of a method for obtaining an application service port number provided in an embodiment of this application;
[0051] Figure 6 is a flowchart of a method for obtaining an application service port number provided in another embodiment of this application;
[0052] Figure 7 is a schematic diagram of the port number application process provided in another embodiment of this application;
[0053] Figure 8 is a flowchart of a method for obtaining an application service port number provided in another embodiment of this application;
[0054] Figure 9 is a flowchart of a method for obtaining application service port number provided in other embodiments of this application;
[0055] Figure 10 is a schematic diagram of sending application data through a port according to an embodiment of this application;
[0056] Figure 11 is a schematic diagram of the chip structure provided in an embodiment of this application. Detailed Implementation
[0057] It should be understood that in the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone.
[0058] In this embodiment, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.
[0059] For ease of description, the basic concepts involved in the embodiments of this application will first be explained. It should be understood that the following description is intended for explanation and illustration, and not for limitation.
[0060] (1) Application services
[0061] Application services, also known as application business services, typically refer to one or more application services that an application (App) supports. For example, application 1 might offer services such as short-range data transmission, audio / video calls, and payment processing.
[0062] (2) UUID
[0063] A universally unique identifier (UUID) is used to uniquely identify a target object, such as an application service. Application vendors can apply to the StarFlash Alliance for a StarFlash protocol standard UUID (i.e., a StarFlash standard UUID), which is typically 2 bytes. Alternatively, electronic devices can also randomly generate UUIDs for application services, which are typically 16 bytes. This application embodiment does not limit the type of UUID.
[0064] (3) Port
[0065] Ports are the basic pathways for electronic devices to transmit data. In the StarSpark protocol architecture, port numbers include well-known ports and dynamic ports. Well-known ports are generally assigned to certain application services; for example, port = 0x01 is always assigned to the information query service. Dynamic ports, on the other hand, are not usually assigned to any specific application service. Application services need to apply for a port number, and these port numbers are typically released afterward.
[0066] (4) Client and server
[0067] The StarSpark protocol defines two device roles: server and client. The server is the provider of the service, receiving and responding to client requests. The client is the user of the service, submitting access requests to the server and receiving the responses returned by the server. A device can simultaneously act as both a server and a client. For example, when device A sends data to device B, device A is the client, and device B is the server.
[0068] After understanding the basic concepts involved in this application, the technical solutions provided by the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0069] Figure 1 is a schematic diagram of a communication system applicable to an embodiment of this application. Referring to Figure 1, the communication system may include multiple electronic devices, such as a first electronic device and a second electronic device, wherein the first electronic device and the second electronic device support communication using wireless communication technology.
[0070] Taking any electronic device in a communication system as an example, the electronic device can be any device with wireless transceiver capabilities, including but not limited to cellular phones, cordless phones, session initiation protocol (SIP) phones, smartphones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices, in-vehicle devices, wearable devices, drone devices, electronic devices in the Internet of Things or the Internet of Vehicles, and other devices connected to a wireless modem.
[0071] Electronic devices can also be electronic devices in virtual reality (VR), augmented reality (AR), industrial control (e.g., smart manufacturing), self-driving, remote medical care, smart grids, smart cities, smart homes, etc.
[0072] Electronic devices can also be personal portable electronic devices, computer peripherals, and various household or industrial electrical equipment, including but not limited to smartphones, smart screens, smart speakers (such as artificial intelligence (AI) speakers and high-fidelity (Hi-Fi) speakers), smart sensors, wireless television headphones, VR headsets, tablet computers, monitors, cameras, laptops, in-vehicle computers, in-vehicle terminals (such as microphones and speakers), projectors, printers, smart bracelets, smartwatches, smart glasses, smart cars, smart lathes, smart monitoring devices, routers, etc. This application does not impose special limitations on the specific form of the electronic devices. Multiple electronic devices in a communication system can be of partially the same type, completely identical, or entirely different.
[0073] It should be noted that the communication system shown in Figure 1 is for illustrative purposes only. This communication system may also include other devices, such as a third electronic device, a fourth electronic device, and a base station, etc., and this application embodiment does not limit this. Furthermore, the types of multiple electronic devices in this communication system may be partially the same, completely identical, or entirely different.
[0074] In the communication system provided in this embodiment, the first electronic device and the second electronic device support at least one wireless communication technology, such as the StarSpark wireless communication technology (hereinafter referred to as StarSpark technology) provided by the StarSpark Alliance. Of course, the first electronic device and the second electronic device can also support other wireless communication technologies, such as cellular communication, wireless fidelity (Wi-Fi), Bluetooth (BT), Bluetooth Low Energy (BLE), and satellite communication. The following mainly describes the communication process between the first electronic device and the second electronic device through StarSpark technology.
[0075] StarSpeed technology is a short-range wireless communication technology provided by the StarSpeed Alliance. It is used to carry out data interaction wireless short-range communication protocols (referred to as StarSpeed Protocol) in application scenarios such as smart cars, smart homes, smart terminals and smart manufacturing.
[0076] Figure 2 is a schematic diagram of the software structure of an electronic device supporting the StarSpark protocol provided in an embodiment of this application. Referring to Figure 2, the electronic device includes an application layer and a StarSpark protocol architecture.
[0077] The application layer includes a series of applications, such as messaging, email, weather, calls, Huawei Health, instant messaging, audio and video playback, games, payment, and digital car key applications.
[0078] An application typically supports one or more application services. Each application service corresponds to a specific business function, or in other words, provides a service to the user. During data transmission using the StarLight protocol, each application service requires a UUID and a port number. The UUID can be a StarLight standard UUID obtained by the application vendor from the StarLight Alliance, or it can be a UUID randomly generated by the application vendor. The port number can be a well-known port number or a dynamically assigned port number by the electronic device.
[0079] In this embodiment, based on the different UUIDs and port numbers, the application services include the following three types.
[0080] The first type of application service, also known as StarFlash private application service, refers to application services that use UUIDs randomly generated by application vendors and use dynamic ports.
[0081] The second type of application service, also known as the StarShine Standard Application Service, refers to application services that have the StarShine Standard UUID and use dynamic ports.
[0082] The third category of application services refers to those with StarFlash standard UUIDs and using well-known ports. Examples include the digital car key application of the Intelligent Car Connectivity Industry Ecosystem Alliance (ICCE).
[0083] It should be noted that, among the various application services within the numerous applications at the application layer, depending on the application vendor's configuration, some application services support communication using the StarScan protocol, while others do not. For ease of description, the application services mentioned below refer to those that support communication using the StarScan protocol (e.g., for data transmission).
[0084] The StarShine protocol architecture, from top to bottom, includes the basic application layer, the basic service layer, and the StarShine access layer. The basic service layer and the basic application layer are referred to as the StarShine upper layer, while the StarShine access layer can also be called the StarShine lower layer. The specific functions of each layer are shown below.
[0085] (1) Basic Application Layer
[0086] In this embodiment, the basic application layer includes a location information management module, a device information management module, a common protocol module, and a data transmission interface. Details are shown below.
[0087] The location information management module is used to determine and update the location information of electronic devices, as well as to determine and update the distance information between the electronic device and other electronic devices.
[0088] The device information management module is used to manage basic information about electronic devices, such as the device's appearance, model name (e.g., HUAWEI Mate 60), manufacturer information, device serial number, and software and hardware version number.
[0089] The public protocol module, after the StarFlash function is activated, assigns a port to the application service based on its UUID, returns the port to the application, and stores the mapping relationship between the application service's UUID and the port. This mapping relationship can also be referred to as the application service's port attribute. Furthermore, after an electronic device establishes a StarFlash connection with other electronic devices (referred to as peer devices), the public protocol module can obtain the port attributes of the same application service on the peer device based on the application service's request; alternatively, after establishing a StarFlash connection with a peer device, it can automatically obtain the port attributes of all application services on the peer device that use dynamic ports for use by the local application service.
[0090] The data transmission interface includes a mapping relationship between application services and ports, and transmits data between the application layer and the basic service layer based on this mapping relationship. For example, according to the mapping relationship between application services and ports, the interface transmits data to be sent by the application service to the basic service layer, or transmits data from other electronic devices from the basic service layer to the application service. In addition, after the StarFlash function is activated, the data transmission interface can also assign a port to the application service based on its UUID, return the port to the application, and store the mapping relationship between the application service's UUID and the port.
[0091] (2) Basic Service Layer
[0092] In this embodiment, the basic service layer includes a device discovery module, a connection management module, a measurement management module, a quality of service (QoS) management module, a security management module, a 5G convergence module, a Sparklink service access protocol (SSAP) module, a data transmission management module, and a transmission and control module. Details are shown below.
[0093] The device discovery module handles the device discovery and pairing process between electronic devices by calling the capabilities of the StarSpark access layer. Specifically, it involves multiple aspects such as device discovery, security authentication, key negotiation, connection establishment and maintenance, and device management, to ensure that devices can establish StarSpark connections securely and reliably.
[0094] The connection management module is mainly used for establishing, updating, and deleting transmission channels; maintaining the mapping relationship between application service ports and transmission channel identification (TCID); maintaining the mapping relationship between transmission channels and logical channels of the StarSpark access layer; triggering the StarSpark access layer to establish, update, or delete logical channels; feeding back the current establishment status of transmission channels to the QoS management module and indicating the established transmission channel TCID to the StarSpark access layer; selecting transmission paths for the StarSpark access layer; maintaining the interaction of interface information with the access layer; and providing the access layer with service modes and cycles, etc.
[0095] The measurement management module is used to trigger physical layer signal quality measurements at the StarSpark access layer; manage measurements for existing transmission channels; and provide a unified measurement service interface for other modules within the StarSpark device (such as the QoS management module, 5G convergence module, etc.) or authorized applications. It allows corresponding functional modules to provide configuration information for desired measurements to the measurement management module and to query the measurement results.
[0096] The QoS management module determines the quality of service that the StarShine wireless communication system needs to provide based on factors such as service transmission requirements and network conditions, ensuring that the transmission capacity of the StarShine wireless communication system matches service demands. Specifically, it supports the following functions: QoS parameter configuration and authorization for StarShine transmission channels; management and maintenance of QoS mapping rules between service flows and transmission channels; instructing the connection management module to establish new transmission channels or change transmission channel mapping relationships; and QoS-based traffic monitoring.
[0097] The security management module is used to provide secure connectivity and 5G converged security services for upper-layer applications. Specifically, it supports the following functions: secure connection management; security status management; authorization management; and 5G converged security management.
[0098] The 5G convergence module is used to enable interaction between G nodes or T nodes and the 5G core network. Specifically, it supports the following functions: selection of trusted G nodes; registration of T nodes or G nodes; distribution of QoS policies; and remote status query of the StarSpark wireless communication system.
[0099] The SSAP module, also known as the Service Management module, is used for service management and maintenance within devices, as well as service discovery between devices. Specifically, it supports the following functions: service registration, updating, and deletion within devices; service information management and maintenance within devices; service discovery between devices; information reading between devices; information writing between devices; error handling for information exchange between devices; server-side notifications and instructions; method interaction operations; and event reporting operations.
[0100] The data transmission management module includes the application service's UUID, as well as the application service's port number on the local end and the port number on the peer end, used for data packet encapsulation and parsing. For example, based on the application service's UUID, it adds source and destination port numbers to the application data to be sent to form a data packet, so that it can be sent to the peer end. Alternatively, it parses the data packet to determine the source and destination port numbers, and sends the received application data to the corresponding application service according to the mapping relationship between the destination port number and the UUID.
[0101] The transmission and control module controls the data transmission process in the transmission channel. This includes functions such as fragmentation and aggregation of upper-layer session data units (SDUs), frame generation of protocol data units (PDUs), transmission of PDUs on the transmission channel, and flow control, splitting, and relaying during PDU transmission. Additionally, the transmission and control module defines transmission channel measurement functions based on measurement frames.
[0102] (3) Starlight Access Layer
[0103] The SparkLink Access Layer, or simply Access Layer, supports various wireless access technologies, including but not limited to SparkLink Basic (SLB), SparkLink Low Energy (SLE), and other future SparkLink Alliance access technologies. SLB and SLE provide different transmission services to meet different service requirements. SLB supports service scenarios with transmission needs such as low latency, high reliability, precise synchronization, high concurrency, and high security. SLE supports service scenarios with low power consumption requirements. Electronic devices can choose to use SLB or SLE alone, or simultaneously, depending on service needs.
[0104] In electronic devices, the StarSpark protocol architecture supports applications establishing private services to transmit application data via SSAP. For example, as shown in Figure 2, its corresponding transmission path 1 includes the application layer—common protocol module—SSAP module—transmission and control module—SLB / SLE. Additionally, the StarSpark protocol architecture also supports identifying application services via port numbers and sending data to peer devices based on those port numbers. Its corresponding transmission path 2 includes the application layer—data transmission interface—data transmission management module—transmission and control module—SLB / SLE.
[0105] When sending application data to the peer device based on the port number, the application data packet must include the port number of the application service on the local end (i.e., the source port number) and the port number of the application service on the peer device (i.e., the destination port number).
[0106] As shown in Table 1, the format of an application data packet includes a protocol version number, source port number, destination port number, optional field bitmap, optional fields, padding fields, and data payload. The protocol version number refers to the version number of the StarSpark protocol. The source port number, destination port number, and optional field bitmap each consist of 16 bits, with the first 8 bits being the high-order byte and the last 8 bits being the low-order byte. The optional field bitmap indicates which optional fields are present. Optional fields contain any additional information that may be needed in the protocol, and their length can be determined according to requirements. Padding fields are used to pad the PDU to ensure that the overall length meets specific requirements or alignment requirements; the length of the padding fields can be adjusted as needed. The data payload is the field used to transmit the actual data; its length is variable and can be determined according to the application's transmission needs.
[0107] Table 1 Application Data Packet Format
[0108] However, while the StarSpeed protocol currently supports sending application data to peer devices via port numbers, it does not yet have the capability to obtain the port number of the application service on the peer device. Therefore, this application provides a method for obtaining the application service port number.
[0109] Figure 3 is a schematic flowchart of a method for obtaining an application service port number provided in an embodiment of this application. Referring to Figure 3, the method includes the following steps S301 to S303.
[0110] S301, the first electronic device and the second electronic device establish a connection through the Star Flash protocol.
[0111] In this embodiment, either the first electronic device or the second electronic device can initiate the StarSignal connection; this application does not impose any limitation on this. Taking the first electronic device initiating the StarSignal connection as an example, the first electronic device broadcasts basic connection information, which includes synchronization signals, SLB / SLE physical layer configuration parameters, etc. The second electronic device establishes a StarSignal connection with the first electronic device based on the scanned basic connection information.
[0112] S302, the first electronic device sends a query message to the second electronic device through the target object of the Star Flash Protocol. The query message is used to query the port number of the application service in the second electronic device.
[0113] It should be noted that this application service specifically refers to the application service that uses the dynamic port of the StarSpark protocol for data transmission, such as the first type of application service and the second type of application service that use the dynamic port of the StarSpark protocol for data transmission.
[0114] As described above, the StarSpark protocol architecture supports data transmission via SSAP and also via port numbers. Therefore, the first electronic device can query the port number of the application service in the second electronic device based on SSAP, or it can query the port number of the application service in the second electronic device based on a well-known port (e.g., the first well-known port). In other words, in this embodiment, the target object includes SSAP or the first well-known port.
[0115] S303, the second electronic device sends a query result to the first electronic device through the target object. The query result includes the port number of the application service in the second electronic device.
[0116] In some embodiments, the query message is used to query the port attributes of all application services using the StarSignal Protocol dynamic ports in the second electronic device. Accordingly, the query result includes the port attributes of all application services using the StarSignal Protocol dynamic ports in the second electronic device. Using this method, the first electronic device can obtain the port attributes of all application services using the StarSignal Protocol dynamic ports in the second electronic device with a single query, achieving high query efficiency.
[0117] In another embodiment, the query message includes the UUID of the first application service, used to query the port number of the first application service in the second electronic device. Accordingly, the query result includes the port number of the first application service in the second electronic device. That is, the electronic device queries only the port number of the application service on the peer device each time, based on the needs of the application service.
[0118] Using the method provided in this application embodiment, an electronic device can obtain the port number of a first application service on a peer device, and then send data to the first application service on the peer device based on the port number. Taking a mobile phone as the first electronic device, a smartwatch as the second electronic device, and Huawei Health's data transmission service as the first application service, the mobile phone can obtain the port number of this data transmission service on the smartwatch using the above method. Based on this, the mobile phone can send the application data from Huawei Health on the mobile phone to Huawei Health on the smartwatch through this port number, thus realizing application data transmission.
[0119] The following sections will explain in detail the process by which the first electronic device obtains the port number from the second electronic device, using both SSAP and well-known ports.
[0120] (i) Obtain the port number of the application service on the second electronic device via SSAP
[0121] When the electronic device obtains the port number of the application service on the second electronic device via SSAP, the transmission path used is transmission path 1 shown in Figure 2, namely, application layer—common protocol module—SSAP module—transmission and control module—SLB / SLE. Based on this, the process of the electronic device applying for the first port number of the first application service locally and obtaining the second port number of the first application service on the second electronic device includes the following:
[0122] After the electronic device enables the StarFlash function, applications using dynamic ports typically need to actively request a port number from the public protocol module of the basic service layer and store the port attributes in the SSAP module so that each application can use it for subsequent data transmission.
[0123] Figure 4 is a schematic diagram of a port number application process provided in an embodiment of this application. This method is applied to a first electronic device or a second electronic device, both of which have a first application (e.g., Huawei Health, chat application, etc.) installed, and the first application at least supports first application services. Based on this, referring to Figure 4, the method includes the following steps S401 to S403.
[0124] S401, the first application sends a port request message to the public protocol module, which includes the UUID of the first application's service.
[0125] The first application may support one or more application services, including the first application service that uses dynamic ports for data transmission. Therefore, after the electronic device enables the StarFlash function, the first application needs to request a data transmission port number for its first application service from the public protocol module. Taking the first application service's UUID = 0x1234 as an example, the port request message includes UUID = 0x1234.
[0126] S402, the public protocol module assigns a port number to the first application service.
[0127] For example, the public protocol module assigns port=0x05 to the first application service with UUID=0x1234.
[0128] S403, the common protocol module writes the port attributes of the first application service to the SSAP module. The port attributes include the mapping relationship between UUID and port.
[0129] For example, the common protocol module writes the port attributes of the application service with UUID=0x1234 to the SSAP module. These port attributes include the mapping relationship between UUID=0x1234 and port=0x05. Additionally, the common protocol module typically also stores the port attributes of the first application service.
[0130] Optionally, when the first application service is a StarFlash private application service, the port attribute of the first application service may also include the vendor ID.
[0131] It is understandable that since each application service in an electronic device that needs to transmit data and uses dynamic ports needs to apply for a port number, the SSAP module usually stores multiple sets of port attributes.
[0132] In some embodiments, the SSAP module can maintain the port attributes of each application service in the form of a list. For example, as shown in Table 2, the SSAP module maintains a list of port attributes for each StarSpark private application service (i.e., the first type of application service). In this list, a set of port attributes for the private application includes port, application vendor ID, and UUID. It should be noted that since the UUID of StarSpark private application services is generated by the application vendor itself, there is a possibility that different StarSpark private application services may have the same UUID. Although this possibility is very small, in order to accurately distinguish application services, it is still necessary to identify them using the vendor ID.
[0133] Table 2. List of Port Attributes for StarShine Private Application Services
[0134] Additionally, as shown in Table 3, the SSAP module also maintains a list of port attributes for StarShine Standard Application Services (i.e., Category II application services). The port attributes for StarShine Standard Application Services include a mapping relationship between port and UUID. It should be noted that since the UUID used by StarShine Standard Application Services is the StarShine Standard UUID applied for by the application vendor for the application service, it cannot be the same as the UUID of other StarShine Standard Application Services. Therefore, the vendor ID may not be included in the port attributes of StarShine Standard Application Services.
[0135] Table 3 Port Attributes of StarSpeed Standard Application Services
[0136] It is understandable that in the communication system shown in Figure 1, after the first and second electronic devices activate the Star Flash function, each relevant application will request a port number for its Star Flash data transmission service based on its UUID, generate port attributes, and store the port attributes in the SSAP module. However, the process of applications requesting port numbers for their services is independent in both electronic devices. Therefore, the port numbers for the same application service may be the same or different in the first and second electronic devices. For example, for application service A, its port1 = 0x04 on the first electronic device side, while its port2 = 0x05 on the second electronic device side. Or, for application service B, its port number is 0x06 on both the first and second electronic devices.
[0137] After the first electronic device and the second electronic device establish a Starlink connection, the first electronic device can obtain the port number of the application service on the second electronic device side. It should be noted that since both transmission path 1 and transmission path 2 in the electronic devices include a transmission and control module and an SLB / SLE, for ease of description, the data processing procedures of the transmission and control module and the SLB / SLE are omitted in the description of data transmission in this embodiment. The process of obtaining the port number is described below using different methods.
[0138] Method 1-1: Obtain the port attributes of all applications using dynamic ports on the other end in advance.
[0139] Figure 5 is a flowchart of a method for obtaining an application service port number according to an embodiment of this application. Referring to Figure 5, the method specifically includes the following steps S501 to S508.
[0140] In this embodiment, the electronic device supports storing the port attributes of all its private applications in the form of lists, sets, etc. For ease of description, the port attributes of all application services using dynamic ports are described below using a port attribute list. For example, the SSAP module of the first electronic device stores a first port attribute list, which includes the identification information of the first electronic device and the port attributes of all application services using dynamic ports in the first electronic device. Similarly, the SSAP module of the second electronic device stores a second port attribute list, which includes the identification information of the second electronic device and the port attributes of all application services using dynamic ports in the second electronic device.
[0141] It should be noted that the application services supported by the first electronic device and the second electronic device may be the same or different. Therefore, the application services involved in the first port attribute list and the second port attribute list may be the same or different. In addition, the port attribute lists of different electronic devices are set with corresponding device identifiers, such as device addresses.
[0142] In step S501, the first electronic device and the second electronic device establish a star-flash connection. See step S301 for details, which will not be repeated here.
[0143] S502, the common protocol module of the first electronic device sends an attribute read request to the SSAP module of the second electronic device. The attribute read request is used to obtain the port attributes of all application services using dynamic ports in the second electronic device.
[0144] S503, the SSAP module of the first electronic device sends the attribute read request to the SSAP module of the second electronic device.
[0145] S504, the SSAP module of the second electronic device sends a second port attribute list to the SSAP module of the first electronic device. The second port attribute list includes the port attributes of all application services using dynamic ports in the second electronic device.
[0146] S505, the SSAP of the second electronic device sends the second port attribute list to the common protocol module.
[0147] S506, the common protocol module of the second electronic device stores the second port attribute list.
[0148] It can be understood that the first electronic device can obtain the port attributes of all application services using dynamic ports in the second electronic device through the above steps S502-S506. Furthermore, the common protocol module of the first electronic device includes both a first port attribute list and a second port attribute list. Additionally, although not shown in the figure, the second electronic device can also send an attribute read request to the first electronic device and receive the first port attribute list returned by the first electronic device, referring to the method shown in S502-S506. That is, the first and second electronic devices can share the port attributes of all application services using dynamic ports that they maintain through the SSAP module.
[0149] It should be noted that after the first and second electronic devices exchange port attribute lists, either the first or second electronic device may install or uninstall some applications that use the StarScan protocol for communication, causing changes to its port attribute list. To ensure normal StarScan communication between the first and second electronic devices, either the first or second electronic device needs to update its port attribute list with the other.
[0150] Taking the installation of a second application on a second electronic device as an example, after successful installation, the second application typically automatically requests a port number from the public protocol module (see S401-S403). The public protocol module assigns port numbers to the supported second application services based on the port request message and stores the port attributes of the second application services in the second port attribute list of the SSAP module. It can be understood that after the second electronic device installs a new second application, its second port attribute list is updated. To prevent the first electronic device from failing to send data related to the second application services to the second electronic device, the second electronic device needs to update its second port attribute list to the first electronic device. For example, the second electronic device can send the entire contents of its second port attribute list to the first electronic device, or it can send only the port attributes of the newly added second application services to the first electronic device.
[0151] Taking the uninstallation of a third application by a second electronic device as an example, the third application typically sends a port cancellation notification to the public protocol module during the uninstallation process. Based on the port cancellation notification, the public protocol module instructs the SSAP module to delete the port attributes of the third application's third application service from the second port attribute list. It can be understood that after uninstalling the third application, the second electronic device's second port attribute list is also updated. Similarly, the second electronic device also needs to update its second port attribute list to the first electronic device. For example, the second electronic device can send the entire contents of its second port attribute list to the first electronic device, or it can only notify the first electronic device to delete the port attributes of the third application service from the second port attribute list.
[0152] In subsequent processes, if an application service in the first electronic device (such as the first application service) needs to send application data to an application service in the second electronic device (such as the first application service), then that application service can directly read the port number of the application service on the second electronic device side in the SSAP module. See S507 to S510 for details.
[0153] S507, the first application of the first electronic device sends a port acquisition request to the common protocol module. The port acquisition request includes the identification information of the second electronic device and the UUID of the first application service.
[0154] For example, the identification information of the second electronic device is address information, and the UUID of the first application service is 0x1234.
[0155] S508, the common protocol module of the first electronic device looks up the second port attribute list based on the identification information of the second electronic device.
[0156] It is understandable that, in addition to establishing a Starlink connection with the second electronic device, the first electronic device may also have established Starlink connections with other electronic devices and stored lists of port attributes for those other electronic devices, such as the third port attribute list of the third electronic device and the fourth port attribute list of the fourth electronic device. Therefore, the first electronic device needs to first look up the second port attribute list based on the identification information of the second electronic device before it can find the correct port number.
[0157] S509, the public protocol module of the first electronic device searches for the second port number of the first application service from the second port attribute list based on the UUID of the first application service.
[0158] S510, the common protocol module of the first electronic device sends the second port number to the first application.
[0159] It should be noted that, in this embodiment of the application, the port number of the first application service on the first electronic device side is referred to as the first port number, and the port number of the first application service on the second electronic device side is referred to as the second port number. For example, based on the UUID of the first application service = 0x1234, the second port number of the first application service in the second electronic device is port = 0x05.
[0160] Method 1-2: Obtain the port number of the application's business on the other end according to the application's requirements.
[0161] Figure 6 is a flowchart of a method for obtaining an application service port number provided in another embodiment of this application. Taking a first electronic device as the data sender and a second electronic device as the data receiver as an example, the method includes the following steps S601 to S607.
[0162] In step S601, the first electronic device and the second electronic device establish a star-flash connection. See step S301 for details, which will not be repeated here.
[0163] S602, the first application of the first electronic device sends a port acquisition request to the common protocol module. The port acquisition request includes the identification information of the second electronic device and the UUID of the first application service.
[0164] If a first application service in a first electronic device needs to send application data to a first application service in a second electronic device, the first application can obtain the second port number of the first application service on the second electronic device through the SSAP module. For example, the UUID of the first application service is 0x1234.
[0165] In some embodiments, when the UUID of the first application service is the identification information generated by the application vendor, that is, when the first application service is a StarFlash private application service, since different application services may have the same UUID, in order to ensure the accuracy of the port query results, the query message also includes the vendor ID of the first application service.
[0166] S603, the common protocol module of the first electronic device sends an attribute read request to the SSAP module. The attribute read request includes the identification information of the second electronic device and the UUID of the first application service.
[0167] In this embodiment, the attribute read request is used to read the second port attribute of the first application service on the second electronic device.
[0168] S604, the SSAP module of the first electronic device obtains the second port attribute of the first application service in the second electronic device from the SSAP module of the second electronic device.
[0169] Taking the example that the SSAP module of the first electronic device is the first SSAP module and the SSAP module of the second electronic device is the second SSAP module, S604 is as follows.
[0170] In some embodiments, the first SSAP first performs a service lookup, and then performs attribute reading after the service is found, in order to improve the accuracy of attribute reading. Based on this, S604 specifically includes the following contents (a) to (d).
[0171] (a) The first SSAP module sends a service lookup message (e.g., FindStructByUuid) to the second SSAP module. The service lookup message includes the UUID of the first application service.
[0172] (b) The second SSAP module sends a service lookup response (e.g., FindStructByUuidRsp) to the first SSAP module. This service lookup response is used to notify that a port attribute corresponding to the UUID of the first application service has been found.
[0173] (c) The first SSAP module sends an attribute read message (e.g., ReadProperty) to the second SSAP module. This attribute read message is used to read the second port attribute corresponding to the UUID of the first application service on the second electronic device side.
[0174] (d) The second SSAP module sends a port attribute read response message (e.g., ReadPropertyRsp) to the first SSAP module. The attribute read response message includes the second port attribute of the first application service on the second electronic device side.
[0175] In other embodiments, the first SSAP directly performs attribute reading. That is, the first SSAP directly sends an attribute reading request to the second SSAP. This attribute reading message is used to read the second port attribute corresponding to the UUID of the first application service on the second electronic device side. Correspondingly, the second SSAP returns the second port attribute to the first SSAP. It can be understood that this method can improve the attribute reading speed.
[0176] S605, the SSAP module of the first electronic device sends the second port attribute of the first application service on the second electronic device side to the common protocol module.
[0177] S606, the public protocol module of the first electronic device parses the second port attribute to obtain the second port number of the first application service in the second electronic device.
[0178] S607, the public protocol module of the first electronic device sends the second port number to the first application service.
[0179] Through the above steps S501 to S510, or S601 to S607, the first electronic device can obtain the port number of the first application service on the second electronic device based on SSAP, and then send the relevant data of the first application service to the second electronic device.
[0180] (ii) Obtaining the port number of the application service on the second electronic device through a well-known port
[0181] When an electronic device obtains the port number of an application service on a second electronic device through a well-known port, the transmission path used is transmission path 2 shown in Figure 2, namely, application layer—data transmission interface—data transmission management module—transmission and control module—SLB / SLE. Based on this, the process by which the electronic device applies for the first port number of the first application service locally and obtains the second port number of the first application service on the second electronic device includes the following:
[0182] In this embodiment, after the electronic device enables the Star Flash function, each application that supports the Star Flash data transmission service also needs to actively apply for a port number for the service that needs to transmit data. Unlike the content "(I) Obtaining the port number of the application service on the second electronic device through SSAP", in this embodiment, the application needs to apply for a port from the data transmission interface and store its port attributes in the data transmission interface so that the first application can use it when transmitting data later.
[0183] Figure 7 is a schematic diagram of a port number application process provided in another embodiment of this application. This method is applied to a first electronic device or a second electronic device, both of which have a first application (e.g., Huawei Health, chat application, etc.) installed on them, and the first application at least supports first application services. Based on this, referring to Figure 7, the method includes the following steps S701 to S703.
[0184] S701, the first application sends a port request message to the data transmission interface, and the port request message includes the UUID of the first application service.
[0185] Taking the first application's UUID=0x1234 as an example, the port request message includes UUID=0x1234.
[0186] S702, the data transmission interface assigns a port number to the first application service.
[0187] For example, assign port=0x05 to the first application service with UUID=0x1234.
[0188] S703, the data transmission interface stores the port attributes of the first application service in the port attribute list, which includes the mapping relationship between UUID and port.
[0189] For example, the port attribute includes a mapping between UUID=0x1234 and port=0x05.
[0190] Optionally, when the first application service is a StarFlash private application service, the port attribute of the first application service may also include the vendor ID.
[0191] It is understood that, through the methods shown in S701 to S703, both the first electronic device and the second electronic device can store the attribute information of each application service using the dynamic port in the data transmission interface.
[0192] After the first electronic device and the second electronic device establish a Starlink connection, the first electronic device can obtain the port number of the private application from the second electronic device. The process of obtaining the port number is explained below using different methods.
[0193] Method 2-1: Obtain the port attributes of all application services using dynamic ports on the other end in advance.
[0194] Figure 8 is a flowchart of a method for obtaining an application service port number according to another embodiment of this application. Referring to Figure 8, the method specifically includes the following steps S801 to S807.
[0195] It should be noted that the data transmission interface of the first electronic device stores a first port attribute list, which includes the identification information of the first electronic device and the port attributes of all application services using dynamic ports in the first electronic device. Similarly, the data transmission interface of the second electronic device stores a second port attribute list, which includes the identification information of the second electronic device and the port attributes of all application services using dynamic ports in the second electronic device.
[0196] S801, the first electronic device and the second electronic device establish a star flash connection.
[0197] It should be noted that after the first and second electronic devices establish a Starlink connection, their well-known ports become available. Based on this, the first and second electronic devices can exchange their port attribute lists through a preset well-known port (e.g., the first well-known port).
[0198] S802, the data transmission interface of the first electronic device sends an attribute read request to the data transmission management module. The attribute read request is used to obtain the second port attribute list of the second electronic device.
[0199] S803, the data transmission management module of the first electronic device sends the attribute read request to the data transmission management module of the second electronic device through the first well-known port.
[0200] S804, the data transmission management module of the second electronic device sends an attribute read request to its data transmission interface.
[0201] S805, the data transmission interface of the second electronic device sends the second port attribute list to its data transmission management module.
[0202] S806, the data transmission management module of the second electronic device sends the second port attribute list to the data transmission management module of the first electronic device through the first well-known port.
[0203] S807, the data transmission management module of the second electronic device sends the second port attribute list to its data transmission interface.
[0204] It is understood that the first electronic device can obtain the port attributes of all application services using dynamic ports in the second electronic device through the above steps S802 to S807. Furthermore, after the above steps S701 to S703 and S802 to S807, the data transmission interface of the first electronic device includes both the first port attribute list and the second port attribute list.
[0205] It should be noted that S802-S807 illustrate the process by which the first electronic device obtains the second port attribute list of the second electronic device. Additionally, although not shown in the figures, the second electronic device can also refer to the method shown in S802-S807 to send an attribute read request to the first electronic device through the first well-known port, and receive the first port attribute list returned by the first electronic device through the first well-known port.
[0206] In some embodiments, the first electronic device and the second electronic device may automatically exchange port attribute lists through a first well-known port after establishing a StarFlash connection. That is, without sending an attribute read request, the first electronic device automatically sends its first port attribute list to the second electronic device, and the second electronic device automatically sends its second port attribute list to the first electronic device.
[0207] It should be noted that after the first and second electronic devices exchange port attribute lists, either the first or second electronic device may install or uninstall some applications that use the StarScan protocol for communication, causing changes to its port attribute list. To ensure normal StarScan communication between the first and second electronic devices, either the first or second electronic device needs to update its port attribute list with the other.
[0208] Taking the installation of a second application on a second electronic device as an example, after successful installation, the second application typically automatically requests a port number for its related second application service from the data transmission interface (see S701-S703). The data transmission interface allocates a port number for the second application service based on the port request message and stores the port attributes of the second application service in the second port attribute list. It can be understood that after the second electronic device installs the second application, its second port attribute list is updated. To prevent transmission failure when the first electronic device sends data related to the second application service to the second electronic device, the second electronic device needs to update its second port attribute list with the first electronic device. For example, the second electronic device can send the entire contents of its second port attribute list to the first electronic device, or it can send only the port attributes of the newly added second application service to the first electronic device.
[0209] Taking the uninstallation of a third application by a second electronic device as an example, the third application typically sends a port cancellation notification to the port status management module during the uninstallation process. The port status management module then removes the attribute information of the third application's related services from the second port attribute list based on the port cancellation notification. It can be understood that after uninstalling the third application, the second electronic device's second port attribute list is also updated. Similarly, the second electronic device also needs to update its second port attribute list to the first electronic device. For example, the second electronic device can send the entire contents of its second port attribute list to the first electronic device, or it can simply notify the first electronic device to delete the port attributes of the third application's services from the second port attribute list.
[0210] In subsequent processes, if the first application service in the first electronic device needs to send application data to the first application service in the second electronic device, the application can directly obtain the port number of its application service on the second electronic device side from the second port attribute list of the data transmission interface. See S808 to S811 for details.
[0211] S808, the first application of the first electronic device sends a port acquisition request to the data transmission interface. The port acquisition request includes the identification information of the second electronic device and the UUID of the first application service.
[0212] For example, the UUID of the first application service is 0x1234.
[0213] S809, the data transmission interface of the first electronic device determines the second port attribute list based on the identification information of the second electronic device.
[0214] S810, the data transmission interface of the first electronic device searches for the second port number of the first application service in the second electronic device from the second port attribute list based on the UUID.
[0215] For example, the second port number corresponding to the UUID=0x1234 of the first application service is port=0x05.
[0216] S811, the data transmission management module of the first electronic device sends the second port number to the first application.
[0217] Method 2-2: Based on the application's requirements, obtain the port number of the application's business on the other end through well-known ports.
[0218] Figure 9 is a flowchart of a method for obtaining an application service port number provided in other embodiments of this application. Taking a first electronic device as the data sender and a second electronic device as the data receiver as an example, the method includes the following steps S901 to S907.
[0219] S901, the first electronic device establishes a starlight connection with the second electronic device.
[0220] S902, the first application of the first electronic device sends a port acquisition request to the data transmission interface. The port acquisition request includes the identification information of the second electronic device and the UUID of the first application service.
[0221] In the first electronic device, if the first application service needs to send application data to the first application service of the second electronic device, it can obtain the second port number of the first application service on the second electronic device side through the data transmission interface. For example, the UUID of the first application service is 0x1234.
[0222] S903, the data transmission interface of the first electronic device sends a port acquisition request to its data transmission management module.
[0223] S904, the data transmission management module of the first electronic device sends a service query message to the data transmission management module of the second electronic device through the first well-known port. The service query message is used to query the second port attributes of the second application service on the second electronic device, including the UUID of the first application service.
[0224] For example, taking the first application service's UUID = 0x1234 and the first well-known port as port = 0x01, as shown in Table 4-1, the data packet corresponding to the service query message includes the source port number (srcport = 0x01), the destination port number (dstport = 0x01), and the service query message. As shown in Table 4-2, the service query message includes the message type 0x01 corresponding to the service query, message length = 0x03, the UUID length of the first application service = 0x02, and the UUID of the first application service = 0x1234. The message type 0x01 indicates that the service query message is used to query the port number of the application service.
[0225] Table 4-1
[0226] Table 4-2
[0227] S905, the data transmission management module of the second electronic device sends a service query message to its data transmission interface.
[0228] S906, the data transmission interface of the second electronic device searches for the second port number of the first application service in the second electronic device in the second port attribute list based on the UUID in the service query message.
[0229] S907, the data transmission interface of the second electronic device sends a service query response to the data transmission management module, the service query response including the second port number.
[0230] S908, the data transmission management module of the second electronic device sends a service query response to the data transmission management module of the first electronic device through the first well-known port, and the service query response includes the second port number.
[0231] As shown in Table 5-1, the service query response includes the source port number (src port = 0x01), the destination port number (dst port = 0x01), and the service query response itself. As shown in Table 5-2, the service query response includes the message type 0x02, message length 0x03, the UUID length of the first application service 0x02, the UUID of the first application service 0x1234, and the port number of the first application service on the second electronic device 0x05.
[0232] Table 5-1
[0233] Table 5-2
[0234] S909, the data transmission management module of the first electronic device sends the second port number to the data transmission interface.
[0235] S910, the data transmission interface of the first electronic device sends the second port number to the first application.
[0236] Through steps S801-S811 or S901-S910 described above, the first electronic device can obtain the port number of the first application service on the second electronic device via primitive communication based on a well-known port, and thus send data to the first application service on the second electronic device. This process does not rely on the electronic device supporting SSAP and can be widely used with various electronic devices that support the StarFlash protocol.
[0237] Next, the process of the first application service sending data to the second electronic device using the obtained second port number will be explained in detail.
[0238] In one example, the first application service of the first application has a first port number (port1) of 0x04 on the first electronic device side and a second port number (port2) of 0x05 on the second electronic device side. The first application service sends application data from the first electronic device to the second electronic device based on transmission path 2, as shown below.
[0239] On the first electronic device side, referring to Figure 10, the first application first sends application data related to its service to the data transmission management module via the data transmission interface. The data transmission management module obtains the first port number (port1 = 0x04) and the second port number (port2 = 0x05) corresponding to the first application's UUID from the data transmission interface. It then encapsulates the application data using the first port number as the source port number and the second port number as the destination port number, forming an application data packet. Subsequently, the data transmission management module sends this data to the second electronic device through the transmission and control module and the access layer.
[0240] On the second electronic device side, as shown in Figure 10, after the access layer receives the application data packet, it sends the application data packet to the data transmission management module through the transmission and control module. The data transmission management module parses the application data packet to obtain the source port number port1 = 0x04, the destination port number port2 = 0x05, and the application data. The parsed data is then sent to the first application service of the first application through the data transmission interface.
[0241] It should be noted that in the above process, the access layer capability called by the first application service can be either SLB or SLE, and this application embodiment does not impose any restrictions on this.
[0242] In addition, after the first electronic device disconnects from the second electronic device via the Star Flash connection, or after the first electronic device disables the Star Flash function, the first electronic device deletes the port attributes of the application services stored locally on the second electronic device side to save device memory resources.
[0243] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0244] This application also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method for obtaining the application service port number as provided in the above embodiments.
[0245] This application also provides a chip, as shown in FIG11. The chip includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, it implements the method for obtaining the application service port number provided in the above embodiments.
[0246] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method for obtaining application service port numbers provided in the above embodiments.
[0247] This application also provides a computer program product, which includes a computer program that, when run by an electronic device, enables the electronic device to implement the method for obtaining application service port numbers provided in the above embodiments.
[0248] It should be understood that the processor mentioned in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0249] It should also be understood that the memory mentioned in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DRRAM).
[0250] In the embodiments provided in this application, the division of each framework or module is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple frameworks or modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0251] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0252] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0253] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0254] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for obtaining an application service port number, characterized in that, Applied to a first electronic device, wherein the first electronic device and a second electronic device are connected via a StarScan protocol, the method includes: A query message is sent to the second electronic device through the target object in the Star Flash Protocol. The target object includes the Star Flash Service Interaction Protocol (SSAP) or a first well-known port. The application service uses the dynamic port of the Star Flash Protocol. The query message is used to query the port number of the application service in the second electronic device. The target object receives query results from the second electronic device, the query results including the port number of the application service in the second electronic device.
2. The method according to claim 1, characterized in that, The query message is used to query the port attributes of all application services using the dynamic port in the second electronic device. The port attributes include the mapping relationship between the universal unique identifier information UUID and the port number. The query results include the port attributes of all application services in the second electronic device that use the dynamic port.
3. The method according to claim 2, characterized in that, The method further includes: Receive an attribute update notification from the second electronic device, the attribute update notification being used to notify the addition of port attributes for a second application service, or the deletion of port attributes for a third application service.
4. The method according to claim 1, characterized in that, The query message includes the UUID of the first application service, the first application service uses the dynamic port, and the query message is used to query the port number of the first application service in the second electronic device. The query results include the port number of the first application service in the second electronic device.
5. The method according to claim 4, characterized in that, When the target object is the first well-known port, the data packet of the query message includes the following: The source port number is the port number of the first well-known port; The destination port number is the port number of the first well-known port; Message type identifier, corresponding to the service query message; The UUID of the first application service.
6. The method according to claim 4 or 5, characterized in that, The query result data packet includes the following: The source port number is the port number of the first well-known port; The destination port number is the port number of the first well-known port; Message type identifier, corresponding to the service query response; The UUID of the first application service; The port number of the first application service in the second electronic device.
7. The method according to any one of claims 4 to 6, characterized in that, If the UUID of the first application service is an identifier generated by the application vendor, the query message also includes the vendor identity identifier of the first application service.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: After the first electronic device disconnects from the Star Flash connection with the second electronic device, or after the first electronic device disables the Star Flash function, the port number of the application service in the second electronic device is deleted.
9. A method for obtaining an application service port number, characterized in that, Applied to a second electronic device, wherein the first electronic device and the second electronic device are connected via a StarScan protocol, the method includes: The query message is received from the first electronic device through the target object in the StarFlash protocol. The target object includes the StarFlash Service Interaction Protocol (SSAP) or a first well-known port. The application service uses the dynamic port of the StarFlash protocol. The query message is used to query the port number of the application service in the second electronic device. The query result is sent to the second electronic device through the target object, and the query result includes the port number of the application service in the second electronic device.
10. The method according to claim 9, characterized in that, The query message is used to query the port attributes of all application services using the dynamic port in the second electronic device. The port attributes include the mapping relationship between the universal unique identifier information UUID and the port number. The query results include the port attributes of all application services in the second electronic device that use the dynamic port.
11. The method according to claim 10, characterized in that, The method further includes: Send an attribute update notification to the first electronic device. The attribute update notification is used to notify the addition of port attributes for a second application service, or to delete port attributes for a third application service.
12. The method according to claim 9, characterized in that, The query message includes the UUID of the first application service, which is used to query the port number of the first application service in the second electronic device. The query results include the port number of the first application service in the second electronic device.
13. The method according to claim 12, characterized in that, When the target object is the first well-known port, the data packet of the query message includes the following: The source port number is the port number of the first well-known port; The destination port number is the port number of the first well-known port; Message type identifier, corresponding to the service query message; The UUID of the first application service.
14. The method according to claim 12 or 13, characterized in that, The query result data packet includes the following: The source port number is the port number of the first well-known port; The destination port number is the port number of the first well-known port; Message type identifier, corresponding to the service query response; The UUID of the first application service; The port number of the first application service in the second electronic device.
15. The method according to any one of claims 12 to 14, characterized in that, If the UUID of the first application service is an identifier generated by the application vendor, the query message also includes the vendor identity identifier of the first application service.
16. The method according to any one of claims 9 to 15, characterized in that, Before receiving a query message from the first electronic device via the target object in the StarFlash protocol, the method further includes: In response to the second electronic device activating the Star Flash function, the second electronic device generates port attributes for the application service according to the request of the application service. The port attributes include the mapping relationship between UUID and port number.
17. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method as described in any one of claims 1 to 16.
18. A chip, characterized in that, The chip includes a processor and a memory, the memory storing a computer program that, when executed by the processor, implements the method as described in any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 16.
20. A computer program product, characterized in that, The computer program product includes a computer program that, when run by an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 16.