Method, system, vehicle and storage medium for in-vehicle application to access network service
By establishing an adaptive access framework, reconstructing the access address using the target client, and selecting the target request library, the problems of low flexibility and efficiency in vehicle applications accessing network services are solved, enabling flexible and efficient access by switching access protocols or network databases according to access needs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING CHANGAN TECH CO LTD
- Filing Date
- 2023-02-22
- Publication Date
- 2026-05-19
AI Technical Summary
Existing in-vehicle applications cannot switch access protocols or network databases as needed when accessing network services, resulting in low flexibility and efficiency.
An adaptation access framework is established, which includes adaptation clients for multiple network services and network request libraries for multiple adaptation application scenarios. The access address is reconstructed through the target client and the required parameters of the protocol are extracted. The target request library is selected according to the adaptation application scenario to establish the service access request.
It improves the flexibility and efficiency of in-vehicle applications accessing network services and solves the problem of in-vehicle applications needing to integrate a large number of access protocols or network databases.
Smart Images

Figure CN116233214B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of service access technology, and in particular to a method, system, vehicle, and storage medium for in-vehicle applications to access network services. Background Technology
[0002] With the continuous popularization of 4G and 5G, and the development of in-vehicle network technology, there are more and more in-vehicle applications on vehicle infotainment systems, and the functions of these applications are becoming increasingly sophisticated. Many in-vehicle applications rely on accessing the Internet to run. For example, some in-vehicle applications access web services via HTTP (Hypertext Transfer Protocol) / HTTPS (Hypertext Transfer Protocol Secure) protocols. Different web services use different access protocols, and different network request libraries corresponding to HTTP / HTTPS protocols have their own advantages in different application scenarios.
[0003] However, existing in-vehicle applications cannot switch access protocols or network databases as needed when accessing network services. They need to integrate a large number of access protocols and request libraries, resulting in poor flexibility and low efficiency for in-vehicle applications to access network services. Summary of the Invention
[0004] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0005] In view of the shortcomings of the prior art described above, the present invention discloses a method, system, vehicle and storage medium for in-vehicle applications to access network services, so as to improve the flexibility of in-vehicle applications to access network services.
[0006] This invention provides a method for an in-vehicle application to access network services, comprising: establishing an adaptation access framework, the adaptation access framework including multiple adaptation clients corresponding to multiple network services and multiple network request libraries corresponding to multiple adaptation application scenarios, wherein the adaptation clients are established according to the service access protocols corresponding to each of the network services; responding to service access data of an in-vehicle application for any network service, identifying the network service as the target service, and identifying the target client corresponding to the target service from the adaptation clients, wherein the service access data includes an original access address and an original message header; reconstructing the original access address using the target client to obtain a reconstructed access address corresponding to the target service, and extracting the required parameters of the protocol from the original message header; determining a target request library suitable for the service access data from the network request library according to the adaptation application scenario, and establishing a service access request according to the target request library and the required parameters of the protocol; and sending the service access request to the reconstructed access address to access the target service.
[0007] Optionally, after sending the service access request to the reconstructed access address, the method further includes: receiving the request response result and / or request return data from the target service; and using the target client to send the request response result and / or request return data to the vehicle application.
[0008] Optionally, sending the service access request to the reconstructed access address includes: the adapted access framework further includes at least one service access interface corresponding to an access request method, and the service access data further includes a specified request method; determining a target access interface from the service access interfaces based on the matching results between the specified request method and each of the access request methods; if the specified request method includes a synchronous request method, then the service access request is sent to the reconstructed access address through the target access interface, while simultaneously blocking the current execution process and / or the current execution thread of the in-vehicle application until a request response result and / or request return data is received from the target service; if the specified request method includes an asynchronous request method, then the service access request is sent to the reconstructed access address through the target access interface.
[0009] Optionally, sending the request response result and / or request return data to the in-vehicle application using the target client includes: if the request response result includes request success, then the request return data includes business data; parsing the business data using the target client to obtain parsed data, and sending the request response result and / or the parsed data to the in-vehicle application; if the request response result includes request failure, then the request return data includes request failure code and / or request failure information; generating request failure information based on at least one of the request response result, the request failure code, and the request failure information, and sending the request failure information to the in-vehicle application.
[0010] Optionally, before using the target client to parse the business data to obtain the parsed data, the method further includes: if the requested return data also includes an access token, then using the target client to determine the token expiration status of the access token; if the token expiration status includes the token not having expired, then parsing the business data to obtain the parsed data; if the token expiration status includes the token having expired, then resending the service access request to the reconstructed access address.
[0011] Optionally, determining the target client corresponding to the target service from the adapted clients includes: the adaptation access framework further includes an application request interface, the adapted client is set with an adapted client identifier, and the service access data further includes the target client identifier corresponding to the target service; receiving the service access data of the in-vehicle application through the application request interface, and determining the target client corresponding to the target client identifier from the adapted clients according to the matching result between the target client identifier and each of the adapted client identifiers.
[0012] Optionally, determining a target request library suitable for the service access data from the network request library according to the adapted application scenario includes: the network request library is provided with an adapted request library identifier, and the service access data further includes a target request library identifier, wherein the adapted request library identifier is used to characterize the adapted application scenario corresponding to the network request library; and determining the target request library corresponding to the target request library identifier from the network request library according to the matching result between the target request library identifier and each of the adapted request library identifiers.
[0013] This invention provides a system for in-vehicle applications to access network services, comprising: an establishment module for establishing an adaptation access framework, the adaptation access framework including multiple adaptation clients corresponding to multiple network services and multiple network request libraries corresponding to multiple adaptation application scenarios, wherein the adaptation clients are established according to the service access protocols corresponding to each of the network services; a first determination module for determining the network service as a target service in response to service access data of an in-vehicle application for any network service, and determining the target client corresponding to the target service from the adaptation clients, wherein the service access data includes an original access address and an original message header; a reconstruction module for reconstructing the original access address using the target client to obtain a reconstructed access address corresponding to the target service, and extracting the required parameters of the protocol from the original message header; a second determination module for determining a target request library suitable for the service access data from the network request library according to the adaptation application scenario, and establishing a service access request according to the target request library and the required parameters of the protocol; and an access module for sending the service access request to the reconstructed access address to access the target service.
[0014] The present invention provides a vehicle, including: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the vehicle to perform the above-described method.
[0015] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described method.
[0016] The beneficial effects of this invention are:
[0017] In response to service access data from in-vehicle applications for network services, the target client corresponding to the target service is determined from the adapted clients. The original access address is reconstructed using the target client to obtain the reconstructed access address. The required protocol parameters are extracted from the original message header, and a service access request is established based on the target request library determined by the adapted application scenario and the required protocol parameters. This service access request is then sent to the reconstructed access address to access the target service. In this way, an adaptation access framework including an adapted client and a network request library is pre-established. The original access address is reconstructed using the adapted client for the target service, and the required protocol parameters are extracted from the original message header to adapt to the service access protocol corresponding to the target service. Simultaneously, the target request library is selected based on the adapted application scenario, and a service access request is established based on the target request library and the required protocol parameters. This solves the problem of in-vehicle applications needing to integrate a large number of access protocols or network databases to access network services. Instead, it switches between access protocols or network databases as needed, thereby improving the flexibility and efficiency of in-vehicle applications accessing network services. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating a method for an in-vehicle application to access network services according to an embodiment of the present invention.
[0019] Figure 2 This is a schematic diagram of the structure of an adaptive access framework in an embodiment of the present invention;
[0020] Figure 3 This is a flowchart illustrating another method for an in-vehicle application to access network services in an embodiment of the present invention;
[0021] Figure 4 This is a schematic diagram of the structure of a system for an in-vehicle application to access network services according to an embodiment of the present invention. Detailed Implementation
[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and sub-samples in the embodiments can be combined with each other.
[0023] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0024] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0025] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0026] Unless otherwise stated, the term "multiple" means two or more.
[0027] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0028] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0029] Combination Figure 1 As shown in the embodiments of this disclosure, a method for an in-vehicle application to access network services is provided, including:
[0030] Step S101: Establish an adaptation access framework, which includes adaptation clients for multiple network services and network request libraries for multiple adaptation application scenarios.
[0031] Among them, the adaptation client is established according to the service access protocol corresponding to each network service;
[0032] Step S102: In response to the service access data of the vehicle application for any network service, the network service is identified as the target service, and the target client corresponding to the target service is identified from the adapted clients.
[0033] The service access data includes the original access address and the original message header;
[0034] Step S103: Reconstruct the original access address using the target client to obtain the reconstructed access address corresponding to the target service, and extract the required protocol parameters from the original message header;
[0035] Step S104: Determine the target request library suitable for service access data from the network request library according to the application scenario, and establish the service access request according to the target request library and the parameters required by the protocol.
[0036] Step S105: Send the service access request to the reconstructed access address to access the target service.
[0037] The method for accessing network services by in-vehicle applications, as provided in this disclosure, responds to service access data from in-vehicle applications. It determines the target client corresponding to the target service from among the adapted clients, reconstructs the original access address using the target client to obtain a reconstructed access address, extracts the required protocol parameters from the original message header, and establishes a service access request based on the target request library determined by the adapted application scenario and the required protocol parameters. The service access request is then sent to the reconstructed access address to access the target service. This approach pre-establishes an adaptation access framework including an adapted client and a network request library. By reconstructing the original access address and extracting the required protocol parameters from the original message header using the adapted client for the target service to adapt to the service access protocol corresponding to the target service, and by selecting the target request library based on the adapted application scenario and establishing a service access request based on the target request library and the required protocol parameters, it solves the problem of in-vehicle applications needing to integrate a large number of access protocols or network databases to access network services. Instead, it switches between access protocols or network databases as needed, thereby improving the flexibility and efficiency of in-vehicle applications accessing network services.
[0038] Optionally, the service access protocol corresponding to the target service can be determined as the target protocol.
[0039] In some embodiments, the original access address is a URL (Uniform Resource Locator) address or an HTTP address represented by a string type, and the original message header is an HTTP protocol header identified by a HashMap.
[0040] Optionally, after sending the service access request to the reconstructed access address, the method further includes: receiving the request response result and / or request return data from the target service; and using the target client to send the request response result and / or request return data to the in-vehicle application.
[0041] Optionally, sending the service access request to the reconstructed access address includes: the adapted access framework also includes at least one service access interface corresponding to the access request method, and the service access data also includes a specified request method; determining the target access interface from the service access interfaces based on the matching result between the specified request method and each access request method; if the specified request method includes a synchronous request method, then the service access request is sent to the reconstructed access address through the target access interface, while blocking the current execution process and / or the current execution thread of the in-vehicle application until the request response result and / or request return data fed back by the target service is received; if the specified request method includes an asynchronous request method, then the service access request is sent to the reconstructed access address through the target access interface.
[0042] In some embodiments, the service access interface is established based on the JAVA (Java programming language) interface, and the access request method includes one or more of synchronous request method, asynchronous request method, and responsive request method.
[0043] In some embodiments, the service access interface corresponding to the synchronous request method has a post (submit data) method and a get (get data) method. The input parameters are the reconstructed access address and the service access request, and the return value is the request response result and / or the request returned data. The service access interface corresponding to the synchronous request method will block the current execution process and / or the current execution thread of the vehicle application until the request response result and / or request returned data fed back by the target service are received.
[0044] In some embodiments, the asynchronous request service access interface has a POST (submit data) method and a GET (get data) method, which take the reconstructed access address and service access request as input parameters and have no return value; the asynchronous request service access interface will not block the current execution process and / or the current execution thread of the vehicle application.
[0045] In some embodiments, the service access interface using the reactive request approach is implemented using Rxjava (ReactiveExtensions Java, a library for writing asynchronous and event-based programs using observable sequences of the Java VM). Its input parameters are the reconstructed access address and the service access request, and its return value is the request response result and / or the request return data. The service access interface using the reactive request approach does not block the current execution process and / or the current execution thread of the in-vehicle application, and at the same time, it receives the request response result and / or the request return data fed back by the target service.
[0046] Optionally, the target client sends the request response result and / or request return data to the in-vehicle application, including: if the request response result includes "request success", then the request return data includes business data; the target client parses the business data to obtain parsed data, and sends the request response result and / or parsed data to the in-vehicle application; if the request response result includes "request failure", then the request return data includes "request failure code" and / or "request failure information", generating request failure information based on at least one of the request response result, request failure code, and request failure information, and sending the request failure information to the in-vehicle application.
[0047] In some embodiments, the adaptive access framework also includes a request result class. The member variables of the request result class include one or more of the following: request response result, request failure code, request failure information, parsed data, and request return data. The request result class generates the final data and sends the request response result, parsed data, request failure information, etc., to the vehicle application, so that the vehicle application can complete different business logic processing based on the final data.
[0048] Optionally, before using the target client to parse the business data and obtain the parsed data, the method further includes: if the requested return data also includes an access token, then using the target client to determine the token expiration status of the access token; if the token expiration status includes the token not having expired, then parsing the business data to obtain the parsed data; if the token expiration status includes the token having expired, then resending the service access request to the reconstructed access address.
[0049] In some embodiments, an adapter client is established through an abstract class, which includes multiple abstract methods such as client name method, complete address construction method, HTTP request method, HTTP response method, and response data parsing method.
[0050] In some embodiments, the client naming method includes generating a globally unique adapter request library identifier.
[0051] In some embodiments, the input parameter of the complete address construction method is the original access address of type string, and the return value of the complete address construction method is the reconstructed access address. The complete address construction method is used to check whether the original access address meets the target protocol, and to reconstruct the original access address according to the target protocol, such as adding the protocol name, changing the character order, etc.
[0052] In some embodiments, the input parameters of the request HTTP method include the original URI (Uniform Resource Identifier) object corresponding to the service access data and the HTTP protocol header identified by a HashMap. The return value of the request HTTP method is a reconstructed URI object with the parameters required by the protocol. The request HTTP method is used to parse and reconstruct the original header. For example, according to the requirements of the target protocol, the access token, timestamp, etc. in the HTTP protocol header are added to the original URI object for use by the adaptation access framework.
[0053] In some embodiments, the input parameters of the HTTP response method include a portion of the request return data, and the return value of the HTTP response method is an action object. The portion of the request return data includes an access token, a timestamp, etc., and the action object includes parsing the business data, resending the service access request to the reconstructed access address, etc.
[0054] In some embodiments, the input parameters of the response data parsing method include business data, the return value of the response data parsing method includes parsed data, and the response data parsing method is used to determine whether the business data meets the requirements of the target protocol and to parse the parsed data required by the vehicle application from the business data.
[0055] Optionally, determining the target client corresponding to the target service from the adapted clients includes: the adaptation access framework also includes an application request interface, the adapted client is set with an adapted client identifier, and the service access data also includes the target client identifier corresponding to the target service; receiving the service access data of the vehicle application through the application request interface, and determining the target client corresponding to the target client identifier from the adapted clients based on the matching result between the target client identifier and each adapted client identifier.
[0056] Optionally, the target request library suitable for service access data is determined from the network request library according to the adapted application scenario, including: the network request library is set with an adapted request library identifier, and the service access data also includes a target request library identifier, wherein the adapted request library identifier is used to characterize the adapted application scenario corresponding to the network request library; and the target request library corresponding to the target request library identifier is determined from the network request library according to the matching result between the target request library identifier and each adapted request library identifier.
[0057] In some embodiments, network services include user login services, file download services, token verification services, file upload services, etc.
[0058] In some embodiments, the application request interface serves as the sole access point for the in-vehicle application, receiving service access data from the in-vehicle application. The application request interface provides a client matching method and a request library matching method. The client matching method is used to determine the target client corresponding to the target client identifier from the adapted clients based on the matching results between the target client identifier and each adapted client identifier. The request library matching method is used to determine the target request library corresponding to the target request library identifier from the network request library based on the matching results between the target request library identifier and each adapted request library identifier.
[0059] In some embodiments, the network request library includes Http Client, Retrofit, Rest Template, OkHttp, and Url Connection, and is adapted to application scenarios such as big data scenarios and small file transfer scenarios, wherein small files are files smaller than a preset file size threshold.
[0060] Combination Figure 2 As shown, this embodiment of the disclosure provides an adaptive access framework, including an application request interface 201, an adaptive client 202, a network request library 203, and a service access interface 204. The adaptive client includes a target client 205, the network request library includes a target request library 206, and the service access interface includes a target access interface 207. The application request interface connects to an in-vehicle application and receives service access data from the in-vehicle application. Based on the matching results between the target client identifier and each adaptive client identifier, the application request interface determines the target client corresponding to the target client identifier from the adaptive clients. Based on the matching results between the target request library identifier and each adaptive request library identifier, the application request interface determines the target request library corresponding to the target request library identifier from the network request library. The target client checks whether the original access address meets the target protocol and reconstructs the original access address according to the target protocol. Simultaneously, according to the requirements of the target protocol, it adds the access token, timestamp, etc., from the HTTP protocol header to the original URI object for use by the adaptive access framework. The target access interface connects to the target service and sends service access requests to the reconstructed access address to access the target service.
[0061] The adaptive access framework provided in this disclosure, in response to service access data from an in-vehicle application for a network service, determines the target client corresponding to the target service from the adaptive clients, reconstructs the original access address using the target client to obtain the reconstructed access address, extracts the required protocol parameters from the original message header, and establishes a service access request based on the target request library determined by the adaptive application scenario and the required protocol parameters. The service access request is then sent to the reconstructed access address to access the target service. In this way, an adaptive access framework including an adaptive client and a network request library is pre-established. The original access address is reconstructed using the adaptive client for the target service, and the required protocol parameters are extracted from the original message header to adapt to the service access protocol corresponding to the target service. Simultaneously, a target request library is selected based on the adaptive application scenario, and a service access request is established based on the target request library and the required protocol parameters. This solves the problem that in-vehicle applications need to integrate a large number of access protocols or network databases to access network services. Instead, it switches access protocols or network databases according to access needs, thereby improving the flexibility and efficiency of in-vehicle applications accessing network services.
[0062] Combination Figure 3 As shown in the embodiments of this disclosure, a method for an in-vehicle application to access network services is provided, including:
[0063] Step S301: Obtain service access data;
[0064] The service access data includes the original access address, the original message header, the target client identifier, the target request library identifier, and the specified request method.
[0065] Step S302: Select the target client from the adapted clients based on the target client identifier;
[0066] The target client is used to reconstruct the original access address, obtain the reconstructed access address corresponding to the target service, and extract the required protocol parameters from the original message header.
[0067] Step S303: Select the target request library from the network request library according to the target request library identifier;
[0068] The target request library is used to establish a service access request based on the parameters required by the protocol and to construct a complete HTTP request method according to the specified request method.
[0069] Step S304: Determine whether the reconstructed access address is valid. If yes, proceed to step S305; otherwise, proceed to step S301.
[0070] Step S305: Invoke the HTTP request method;
[0071] The process of calling the HTTP method includes extracting the required protocol parameters from the original message header, establishing a service access request based on the target request library and the required protocol parameters, and sending the service access request to the reconstructed access address.
[0072] Step S306: Receive the request response result and / or request return data from the target service;
[0073] The requested data returned includes one or more of the following: access token, business data, request failure code, and request failure information.
[0074] Step S307: Determine if the access token has expired. If yes, proceed to step S311; otherwise, proceed to step S308.
[0075] Specifically, the HTTP response method of the target client is called to determine whether the access token has expired;
[0076] Step S308: Determine whether the request response result is successful. If yes, proceed to step S309; otherwise, proceed to step S310.
[0077] Step S309: Parse the business data to obtain the parsed data, and send the request response result and / or the parsed data to the vehicle application.
[0078] Step S310: Generate request failure information based on at least one of the request response result, request failure code, and request failure information, and send the request failure information to the vehicle application.
[0079] Step S311: Request a new access token, then proceed to step S307.
[0080] The method for accessing network services by in-vehicle applications, as provided in this disclosure, responds to service access data from in-vehicle applications. It determines the target client corresponding to the target service from among the adapted clients, reconstructs the original access address using the target client to obtain a reconstructed access address, extracts the required protocol parameters from the original message header, and establishes a service access request based on the target request library determined by the adapted application scenario and the required protocol parameters. The service access request is then sent to the reconstructed access address to access the target service. This approach pre-establishes an adaptation access framework including an adapted client and a network request library. By reconstructing the original access address and extracting the required protocol parameters from the original message header using the adapted client for the target service to adapt to the service access protocol corresponding to the target service, and by selecting the target request library based on the adapted application scenario and establishing a service access request based on the target request library and the required protocol parameters, it solves the problem of in-vehicle applications needing to integrate a large number of access protocols or network databases to access network services. Instead, it switches between access protocols or network databases as needed, thereby improving the flexibility and efficiency of in-vehicle applications accessing network services.
[0081] Combination Figure 4As shown, this embodiment of the present disclosure provides a system for an in-vehicle application to access network services, including an establishment module 401, a first determination module 402, a reconstruction module 403, a second determination module 404, and an access module 405. The establishment module 401 is used to establish an adaptation access framework, which includes adaptation clients corresponding to multiple network services and network request libraries corresponding to multiple adaptation application scenarios. The adaptation clients are established according to the service access protocols corresponding to each network service. The first determination module 402 is used to determine the network service as the target service in response to the service access data of the vehicle application for any network service, and to determine the target client corresponding to the target service from the adaptation clients. The service access data includes the original access address and the original message header. The reconstruction module 403 is used to reconstruct the original access address using the target client to obtain the reconstructed access address corresponding to the target service, and to extract the required parameters of the protocol from the original message header. The second determination module 404 is used to determine the target request library suitable for the service access data from the network request library according to the adaptation application scenario, and to establish a service access request according to the target request library and the required parameters of the protocol. The access module 405 is used to send the service access request to the reconstructed access address to access the target service.
[0082] The system for accessing network services by in-vehicle applications, as provided in this disclosure, responds to service access data from in-vehicle applications. It determines the target client corresponding to the target service from among the adapted clients, reconstructs the original access address using the target client to obtain a reconstructed access address, extracts the required protocol parameters from the original message header, and establishes a service access request based on the target request library determined by the adapted application scenario and the required protocol parameters. The service access request is then sent to the reconstructed access address to access the target service. In this way, an adaptation access framework including an adapted client and a network request library is pre-established. The original access address is reconstructed using the adapted client for the target service, and the required protocol parameters are extracted from the original message header to adapt to the service access protocol corresponding to the target service. Simultaneously, a target request library is selected based on the adapted application scenario, and a service access request is established based on the target request library and the required protocol parameters. This solves the problem of in-vehicle applications needing to integrate a large number of access protocols or network databases to access network services. Instead, it switches between access protocols or network databases as needed, thereby improving the flexibility and efficiency of in-vehicle applications accessing network services.
[0083] This disclosure also provides a vehicle, including: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the vehicle to perform any of the methods in this embodiment.
[0084] This disclosure also provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements any of the methods in this embodiment.
[0085] The computer-readable storage medium in the embodiments of this disclosure will be understood by those skilled in the art: all or part of the steps of the above method embodiments can be implemented by hardware related to computer programs. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disk, or optical disk.
[0086] The electronic device disclosed in this embodiment includes a processor, a memory, a transceiver, and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication between them. The memory is used to store computer programs, the communication interface is used to perform communication, and the processor and the transceiver are used to run the computer programs, so that the electronic device performs the various steps of the above method.
[0087] In this embodiment, the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0088] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), graphics processing units (GPUs), network processors (NPs), etc.; they can also be 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, or discrete hardware components.
[0089] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated subsamples, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other subsamples, wholes, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes the element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0090] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0091] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some sub-samples may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to implement this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A method for an in-vehicle application to access network services, characterized in that, include: An adaptation access framework is established, which includes adaptation clients corresponding to multiple network services and network request libraries corresponding to multiple adaptation application scenarios. The adaptation clients are established according to the service access protocols corresponding to each of the network services. In response to service access data of any network service by an in-vehicle application, the network service is identified as the target service, and the target client corresponding to the target service is identified from the adapted clients, wherein the service access data includes the original access address and the original message header; The original access address is reconstructed using the target client to obtain the reconstructed access address corresponding to the target service, and the required protocol parameters are extracted from the original message header. Based on the adapted application scenario, a target request library suitable for the service access data is determined from the network request library, and a service access request is established based on the target request library and the parameters required by the protocol. The service access request is sent to the reconstructed access address to access the target service.
2. The method according to claim 1, characterized in that, After sending the service access request to the reconstructed access address, the method further includes: Receive the request response result and / or request return data from the target service; The target client is used to send the request response result and / or request return data to the vehicle application.
3. The method according to claim 2, characterized in that, Sending the service access request to the reconstructed access address includes: The adaptive access framework also includes at least one service access interface corresponding to the access request method, and the service access data also includes the specified request method; The target access interface is determined from the service access interface based on the matching results between the specified request method and each of the access request methods; If the specified request method includes a synchronous request method, the service access request is sent to the reconstructed access address through the target access interface. At the same time, the current execution process and / or the current execution thread of the vehicle application are blocked until the request response result and / or request return data are received from the target service. If the specified request method includes an asynchronous request method, then the service access request is sent to the reconstructed access address through the target access interface.
4. The method according to claim 2, characterized in that, Sending the request-response result and / or request-return data to the in-vehicle application using the target client includes: If the request response result includes a successful request, then the requested returned data includes business data. The target client is used to parse the business data to obtain parsed data, and the request response result and / or the parsed data are sent to the in-vehicle application. If the request response result includes a request failure, then the request return data includes a request failure code and / or request failure information. Request failure information is generated based on at least one of the request response result, the request failure code, and the request failure information, and the request failure information is sent to the in-vehicle application.
5. The method according to claim 4, characterized in that, Before parsing the business data using the target client to obtain the parsed data, the method further includes: If the requested data also includes an access token, then the expiration status of the access token is determined using the target client. If the token expiration status includes the token not being expired, then the business data is parsed to obtain the parsed data; If the token expiration status includes "token has expired", then the service access request will be resent to the reconstructed access address.
6. The method according to any one of claims 1 to 5, characterized in that, Determining the target client corresponding to the target service from the adapted clients includes: The adaptation access framework also includes an application request interface, the adaptation client is set with an adaptation client identifier, and the service access data also includes the target client identifier corresponding to the target service; The system receives service access data from the vehicle application through the application request interface, and determines the target client corresponding to the target client identifier from the adapted clients based on the matching results between the target client identifier and each of the adapted client identifiers.
7. The method according to claim 6, characterized in that, Based on the adapted application scenario, a target request library suitable for the service access data is determined from the network request library, including: The network request library is equipped with an adaptation request library identifier, and the service access data also includes a target request library identifier, wherein the adaptation request library identifier is used to characterize the adaptation application scenario corresponding to the network request library. The target request library corresponding to the target request library identifier is determined from the network request library based on the matching results between the target request library identifier and each of the adaptation request library identifiers.
8. A system for in-vehicle applications to access network services, characterized in that, include: A module is established to establish an adaptation access framework, which includes adaptation clients corresponding to multiple network services and network request libraries corresponding to multiple adaptation application scenarios. The adaptation clients are established according to the service access protocols corresponding to each of the network services. The first determining module is configured to, in response to service access data of any network service by an in-vehicle application, determine the network service as the target service and determine the target client corresponding to the target service from the adapted clients, wherein the service access data includes the original access address and the original message header; The reconstruction module is used to reconstruct the original access address using the target client to obtain the reconstructed access address corresponding to the target service, and extract the required protocol parameters from the original message header; The second determining module is used to determine a target request library suitable for the service access data from the network request library according to the adapted application scenario, and to establish a service access request according to the target request library and the parameters required by the protocol. The access module is used to send the service access request to the reconstructed access address in order to access the target service.
9. A vehicle, characterized in that, include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to cause the vehicle to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.