Method for avoiding virtual camera preemption and control system
By adopting preemption mechanism and priority management in the on-board virtual camera system, the virtual camera ID preemption problem is solved, ensuring the stable operation of the application, and improving the driving experience and intelligent automation level.
Patent Information
- Application Number
- CN202411276916.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-24
Smart Images

Figure CN119182887A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of vehicle-mounted cameras, and in particular relates to a method and control for preventing virtual camera preemption. Background Art
[0002] With the digitalization and intelligence of smart cars, cars are being given new functions. One of the changes is the on-board camera. There will be more than one on-board camera, and it will be more functional and all-round. The driver can control the camera switching and display direction through the center console or steering wheel. Among them, virtual cameras are not uncommon in cars. For example, virtual camera technology can be involved in 360-degree surround view systems and driving recorders. However, with multiple settings of vehicle virtual cameras, under the existing technical framework, virtual camera ID preemption often occurs, causing the device application to crash and fail to work properly. Traditionally, it may be necessary to manually adjust the order of applications or close a program in the background first, which brings a poor driving experience and low intelligence and automation. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method and control system for avoiding virtual camera preemption, setting multiple virtual cameras and different virtual cameras corresponding to different priorities, and avoiding the crash of an APP by preemption, thereby ensuring the smooth, stable and normal operation of the application.
[0004] In order to solve the above technical problems, the technical solution of the present invention is: In a first aspect, the present invention provides a method for avoiding virtual camera preemption, the method comprising: Step 1: The camera virtualizes several virtual cameras in the hardware abstraction layer HAL, and each virtual camera corresponds to an ID; Step 2: The App requests access to the camera and preempts the ID based on the preemption mechanism at the Framework layer; Step 3: After grabbing the ID, the App establishes a communication connection with the camera.
[0005] As a preferred embodiment of the present invention, wherein: The preemption mechanism described in step 2 includes: Step 21, when App1 preempts the ID, if the ID has been called by App2, determine whether there is an application in the high priority application list in App1 and App2; Step 22, if App2 has a lower priority, App1 selects the ID; if App2 has a higher priority, App1 starts searching again from the next ID, and repeats the above steps until an ID is selected; Step 23, after App1 terminates the communication connection with the camera, it will pass in the ID selected in step 22 when it requests to access the camera next time.
[0006] As a preferred embodiment of the present invention, wherein: The method for setting the priority of the App is that the App will pass in the package name of the App at the Framework layer, and the priority of the App will be increased by the package name. Specifically: Step 221, according to the access request of App1, obtain the package name of App1; according to the connection relationship between App2 and the camera, obtain the package name of App2, ..., according to the connection relationship between Appn and the camera, obtain the package name of Appn, where n represents the number of Apps; Step 222, determining whether the package name of App1 is in the high priority application list, and determining whether the package name of App2 is in the high priority application list; Step 223: if App1 is in the high priority application list, App1 is determined as a high priority application, App2 cuts off the communication connection relationship with the camera, and App1 establishes a communication connection relationship with the camera; if App2 is in the high priority application list, App2 is determined as a high priority application, and App2 maintains the communication connection relationship with the camera; Step 224, repeat step 223 until App1 establishes a communication connection with the camera.
[0007] In a second aspect, the present invention further proposes a control system, the system comprising: The access request module is used to receive access requests from Apps; The judgment module is used to judge the priority of the App according to the preemption mechanism; a confirmation module, configured to determine an application in the high priority application list as a high priority application when there is an application in the high priority application list; A disconnection module is used to generate a disconnection instruction and send it to the camera to disconnect the communication connection between the App and the camera; The connection module is used to generate a connection permission instruction and send it to the camera so that the App can establish a communication connection with the camera.
[0008] As a preferred embodiment of the present invention, wherein: The method for determining the priority of an App is as follows: According to the access request of App1, the package name of App1 is obtained; according to the connection relationship between App2 and the camera, the package name of App2 is obtained, and ..., according to the connection relationship between Appn and the camera, the package name of Appn is obtained; Determine whether the package name of App1 is in the list of high-priority applications, and determine whether the package name of App2 is in the list of high-priority applications; If App1 is in the high priority application list, App1 is determined as a high priority application, a disconnection instruction is sent to make App2 disconnect the communication connection relationship with the camera, and a connection permission instruction is sent to make App1 establish the communication connection relationship with the camera; If App2 is in the high priority application list, App2 is determined as a high priority application, and App2 maintains a communication connection relationship with the camera; the priority levels of App1 and App2, App3...Appn are continuously determined until App1 establishes a communication connection relationship with the camera.
[0009] Beneficial effects of the present invention: The present invention sets multiple virtual cameras and corresponds to different priorities of different virtual cameras by setting the method for avoiding virtual camera preemption, and avoids the crash of an APP by preemption, thereby ensuring the smooth, stable and normal operation of the application and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them: Figure 1 A flow chart of a method in an embodiment of the present invention; Figure 2 A diagram of a priority setting method in an embodiment of the present invention; Figure 3 1 is a system structure diagram in an embodiment of the present invention. DETAILED DESCRIPTION
[0011] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0012] The present invention is further described in detail below through embodiments and in conjunction with the accompanying drawings. Example 1, please refer to Figure 1 and Figure 2, is an embodiment of the present invention, which provides a method for avoiding virtual camera preemption, comprising: Step 1: The camera virtualizes several virtual cameras in the hardware abstraction layer HAL, and each virtual camera corresponds to an ID; Step 2: The App requests access to the camera and preempts the ID based on the preemption mechanism at the Framework layer. The preemption mechanism described in step 2 includes: Step 21, when App1 preempts the ID, if the ID has been called by App2, determine whether there is an application in the high priority application list in App1 and App2; Step 22, if App2 has a lower priority, App1 selects the ID; if App2 has a higher priority, App1 starts searching again from the next ID, and repeats the above steps until an ID is selected; The method of setting the priority of the App is that the App will pass the package name of the App in the Framework layer and increase the priority of the App through the package name. Specifically: Step 221, according to the access request of App1, obtain the package name of App1; according to the connection relationship between App2 and the camera, obtain the package name of App2, ..., according to the connection relationship between Appn and the camera, obtain the package name of Appn, where n represents the number of Apps; Step 222, determining whether the package name of App1 is in the high priority application list, and determining whether the package name of App2 is in the high priority application list; Step 223: if App1 is in the high priority application list, App1 is determined as a high priority application, App2 cuts off the communication connection relationship with the camera, and App1 establishes a communication connection relationship with the camera; if App2 is in the high priority application list, App2 is determined as a high priority application, and App2 maintains the communication connection relationship with the camera; Step 224, repeat step 223 until App1 establishes a communication connection with the camera.
[0013] Step 23, after App1 terminates the communication connection with the camera, it will pass in the ID selected in step 22 when it requests to access the camera next time.
[0014] Step 3: After grabbing the ID, the App establishes a communication connection with the camera. Example 2, please refer to Figure 3 , is an embodiment of the present invention, which provides a control system, including: The access request module is used to receive access requests from Apps; The judgment module is used to judge the priority of the App according to the preemption mechanism; Methods for determining the priority of App, specifically: According to the access request of App1, the package name of App1 is obtained; according to the connection relationship between App2 and the camera, the package name of App2 is obtained, and so on. n Connection relationship with the camera, get the App n Package name; Determine whether the package name of App1 is in the list of high-priority applications, and determine whether the package name of App2 is in the list of high-priority applications; If App1 is in the high priority application list, App1 is determined as a high priority application, a disconnection instruction is sent to make App2 disconnect the communication connection relationship with the camera, and a connection permission instruction is sent to make App1 establish the communication connection relationship with the camera; If App2 is in the high priority application list, App2 is determined as a high priority application, and App2 maintains a communication connection relationship with the camera; App1 is continued to be determined with App2, App3, ... App n The priority level is set until App1 establishes a communication connection with the camera.
[0015] a confirmation module, configured to determine an application in the high priority application list as a high priority application when there is an application in the high priority application list; A disconnection module is used to generate a disconnection instruction and send it to the camera to disconnect the communication connection between the App and the camera; The connection module is used to generate a connection permission instruction and send it to the camera so that the App can establish a communication connection with the camera.
[0016] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or other arbitrary combinations. When implemented using software, it can be implemented in whole or in part in the form of a computer program product, which includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0017] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0018] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0019] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0020] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0021] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0022] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0023] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for avoiding virtual camera preemption, characterized in that: The method comprises: Step 1: The camera virtualizes several virtual cameras in the hardware abstraction layer HAL, and each virtual camera corresponds to an ID; Step 2: The App requests access to the camera and preempts the ID based on the preemption mechanism at the Framework layer. Step 3: After grabbing the ID, the App establishes a communication connection with the camera.
2. A method for avoiding virtual camera preemption according to claim 1, characterized in that: The preemption mechanism described in step 2 includes: Step 21, when App1 preempts the ID, if the ID has been called by App2, determine whether there is an application in the high priority application list in App1 and App2; Step 22, if App2 has a lower priority, App1 selects the ID; If App2 has a higher priority, App1 starts searching again from the next ID and repeats the above steps until an ID is selected; Step 23: After App1 terminates the communication connection with the camera, it will pass in the ID selected in step 22 the next time it requests to access the camera.
3. A method for avoiding virtual camera preemption according to claim 2, characterized in that: The method for setting the priority of the App is that the App will pass in the package name of the App at the Framework layer, and the priority of the App will be increased by the package name. Specifically: Step 221, according to the access request of App1, obtain the package name of App1; according to the connection relationship between App2 and the camera, obtain the package name of App2, ..., according to App n Connection relationship with the camera, get the App n Package name, where n Indicates the number of apps; Step 222, determining whether the package name of App1 is in the high priority application list, and determining whether the package name of App2 is in the high priority application list; Step 223: if App1 is in the high priority application list, App1 is determined as a high priority application, App2 cuts off the communication connection relationship with the camera, and App1 establishes a communication connection relationship with the camera; if App2 is in the high priority application list, App2 is determined as a high priority application, and App2 maintains the communication connection relationship with the camera; Step 224, repeat step 223 until App1 establishes a communication connection with the camera.
4. A control system, applied to the method for avoiding virtual camera preemption according to any one of claims 1 to 3, characterized in that: The system comprises: The access request module is used to receive access requests from Apps; The judgment module is used to judge the priority of the App according to the preemption mechanism; a confirmation module, configured to determine an application in the high priority application list as a high priority application when there is an application in the high priority application list; A disconnection module is used to generate a disconnection instruction and send it to the camera to disconnect the communication connection between the App and the camera; The connection module is used to generate a connection permission instruction and send it to the camera so that the App can establish a communication connection relationship with the camera.
5. A control system according to claim 4, characterized in that: The method for determining the priority of an App is as follows: According to the access request of App1, the package name of App1 is obtained; according to the connection relationship between App2 and the camera, the package name of App2 is obtained, and so on. n Connection relationship with the camera, get the App n Package name; Determine whether the package name of App1 is in the list of high-priority applications, and determine whether the package name of App2 is in the list of high-priority applications; If App1 is in the high priority application list, App1 is determined as a high priority application, a disconnection instruction is sent to make App2 disconnect the communication connection relationship with the camera, and a connection permission instruction is sent to make App1 establish the communication connection relationship with the camera; If App2 is in the high priority application list, App2 is determined as a high priority application, and App2 maintains a communication connection relationship with the camera; App1 is continued to be determined with App2, App3, ... App n The priority level is set until App1 establishes a communication connection with the camera.
Citation Information
Cited By
Camera access method and related device
CN122534314A
