[go: up one dir, main page]

CN114584815A - Method, computer readable storage medium and device for controlling screen projection in backward mode - Google Patents

Method, computer readable storage medium and device for controlling screen projection in backward mode Download PDF

Info

Publication number
CN114584815A
CN114584815A CN202011381181.9A CN202011381181A CN114584815A CN 114584815 A CN114584815 A CN 114584815A CN 202011381181 A CN202011381181 A CN 202011381181A CN 114584815 A CN114584815 A CN 114584815A
Authority
CN
China
Prior art keywords
mobile terminal
android mobile
control event
control
target terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011381181.9A
Other languages
Chinese (zh)
Inventor
范陈新
许立
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Industrial Utechnology Research Institute
Original Assignee
Shanghai Industrial Utechnology Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Industrial Utechnology Research Institute filed Critical Shanghai Industrial Utechnology Research Institute
Priority to CN202011381181.9A priority Critical patent/CN114584815A/en
Publication of CN114584815A publication Critical patent/CN114584815A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/4104Peripherals receiving signals from specially adapted client devices
    • H04N21/4122Peripherals receiving signals from specially adapted client devices additional display device, e.g. video projector
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/4104Peripherals receiving signals from specially adapted client devices
    • H04N21/4126The peripheral being portable, e.g. PDAs or mobile phones
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • H04N21/4363Adapting the video stream to a specific local network, e.g. a Bluetooth® network
    • H04N21/43637Adapting the video stream to a specific local network, e.g. a Bluetooth® network involving a wireless protocol, e.g. Bluetooth, RF or wireless LAN [IEEE 802.11]

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Telephone Function (AREA)

Abstract

本发明提供了一种可回控投屏方法包括:将安卓移动终端通过USB线连接目标终端;打开所述移动终端的开发者模式;在目标终端通过ADB工具和安卓移动终端自带的app_process工具将一个控制事件输入服务程序在安卓移动终端作为后台服务运行起来,激活安卓移动终端的回控功能;在WIFI投屏模式下,断开安卓移动终端与目标终端的有线连接。安卓移动终端用户在回控投屏操作中不再受有线连接的束缚,操作更灵活,更便捷,改善了用户体验,有利于投屏技术的进一步普及推广。本发明还提供了一种可回控投屏装置,包括安卓移动终端、目标终端;以及一种计算机可读存储介质,因能够实现本发明的可回控投屏方法而具有相应优势。

Figure 202011381181

The present invention provides a returnable screen projection method, which includes: connecting an Android mobile terminal to a target terminal through a USB cable; opening the developer mode of the mobile terminal; using an ADB tool and an app_process tool that comes with the Android mobile terminal on the target terminal Run a control event input service program on the Android mobile terminal as a background service to activate the callback function of the Android mobile terminal; in the WIFI screen projection mode, disconnect the wired connection between the Android mobile terminal and the target terminal. Android mobile terminal users are no longer bound by wired connections in the control screen projection operation, the operation is more flexible and convenient, the user experience is improved, and it is conducive to the further popularization and promotion of screen projection technology. The present invention also provides a reversible screen projection device, including an Android mobile terminal, a target terminal, and a computer-readable storage medium, which have corresponding advantages because the reversible screen projection method of the present invention can be implemented.

Figure 202011381181

Description

一种可回控投屏方法、计算机可读存储介质和装置A reversible screen projection method, computer-readable storage medium and device

技术领域technical field

本发明属于投屏技术领域,具体涉及一种投屏技术中的可回控的投屏方法,及相关的计算机可读存储介质和投屏装置。The present invention belongs to the technical field of screen projection, and in particular relates to a return-controllable screen projection method in the screen projection technology, and a related computer-readable storage medium and a screen projection device.

背景技术Background technique

随着互联网的日益发展和手机、智能平板等移动终端的普及,移动终端因其便携性和连接互联网方式的多样性,能够更方便的获得丰富的互联网信息资源和大量的数据信息;此外移动终端基于其操作系统的特点,界面美观操作方便,例如安卓手机的界面观感和操作的用户体验目前已经很优秀。但是一般移动终端的显示屏幕往往较小,也不易固定在某处使用,而在很多特定的使用场景下,人们往往既需要移动终端获得的互联网内容又希望将获取的内容在固定的更大的屏幕上显示或操作,或有共享显示内容的需求。如在车辆应用中将手机的导航、来电接听控制等投射到固定的车机端屏幕上就是目前非常普遍和具有实际意义的一个需求。所谓“车机’指的是安装在汽车里面的车载信息娱乐产品的简称,车机在功能上能够实现人与车、车与外界(车与车)的信息通讯。在车机投屏方面,将手机用户想在车机上使用的功能投屏到车机上使用,降低了车载计算机系统的开发成本。在车机投屏的应用中除了iOS系统的CarPlay,基于安卓系统的国内通用性较好的,用的较多的就是百度的CarLife。With the increasing development of the Internet and the popularization of mobile terminals such as mobile phones and smart tablets, mobile terminals can more conveniently obtain rich Internet information resources and a large amount of data information due to their portability and the diversity of Internet connection methods; in addition, mobile terminals Based on the characteristics of its operating system, the interface is beautiful and easy to operate. For example, the interface look and feel of Android mobile phones and the user experience of operation are already excellent. However, the display screen of the general mobile terminal is often small, and it is not easy to use it in a fixed place. In many specific usage scenarios, people often need both the Internet content obtained by the mobile terminal and the content obtained in a fixed larger size. Display or operation on the screen, or there is a need to share the display content. For example, in vehicle applications, it is a very common and practical requirement to project the navigation of the mobile phone, the control of incoming calls, etc. onto the fixed screen of the vehicle. The so-called "car machine" refers to the abbreviation of the in-vehicle infotainment products installed in the car. The car machine can functionally realize the information communication between the person and the car, the car and the outside world (car to car). The functions that mobile phone users want to use on the car are projected onto the car, which reduces the development cost of the in-vehicle computer system. In addition to the CarPlay of the iOS system, the Android-based system has better domestic versatility in the application of the car screen projection. , the most used is Baidu's CarLife.

在投屏应用中,人们往往还希望能够在目标终端上进行控制移动终端的操作,就是回控,比如,手机投屏车机时,在车机界面进行的操作回控给手机,其实操作的就是手机本身。CarLife支持USB投屏和WIFI投屏两种模式,USB投屏模式中需要将手机始终用USB线连接着车机,在车机上才能回控手机。而目前CarLife在WIFI投屏模式下的回控是针对基于iOS系统的移动终端的,所以用的是基于iOS系统的协议进行回控。因此对于安卓移动终端,CarLife不支持WIFI投屏模式下的回控操作,这样安卓移动终端的用户在投屏时如果要在目标终端上回过来控制安卓移动终端就不得不受到USB线的约束,降低了用户体验,在投屏应用中不够便捷。In screencasting applications, people often hope to be able to control the operation of the mobile terminal on the target terminal, that is, return control. For example, when the mobile phone casts the screen to the car machine, the operation performed on the car machine interface is controlled back to the mobile phone. In fact, the operation It's the phone itself. CarLife supports two modes: USB screen projection and WIFI screen projection. In USB screen projection mode, you need to always connect the mobile phone to the car machine with a USB cable, and then the mobile phone can be controlled back on the car machine. At present, the callback control of CarLife in the WIFI screen projection mode is aimed at the mobile terminal based on the iOS system, so it uses the protocol based on the iOS system for the callback control. Therefore, for the Android mobile terminal, CarLife does not support the return control operation in the WIFI screen projection mode, so that the user of the Android mobile terminal has to be constrained by the USB cable if he wants to control the Android mobile terminal on the target terminal when the screen is projected. It reduces the user experience and is not convenient enough in screencasting applications.

发明内容SUMMARY OF THE INVENTION

本发明是基于上述现有技术的问题而进行的,目的在于提供一种可回控投屏方法、计算机可读存储介质和装置,实现安卓移动终端的用户既可以在USB投屏模式时在目标终端有线回控(回过来控制)安卓移动终端,也可以在WIFI投屏模式时无线回控。The present invention is based on the above-mentioned problems of the prior art, and aims to provide a reversible screen projection method, computer-readable storage medium and device, so that the user of the Android mobile terminal can be in the USB screen projection mode. The terminal is wired back to control (return control) Android mobile terminal, and it can also be wirelessly controlled in WIFI screen projection mode.

在本发明的叙述中,所述“投屏”是指将一个终端的屏幕数据传输至另一个终端上显示。为了方便说明,本申请中的一个终端指安卓移动终端。另一个终端主要指电视机、汽车中控台(车机)等需要接受投屏的电子设备,以下称为目标终端。投屏功能可以是由计算机系统提供的,也可以由应用提供的,本申请中提供投屏功能的称作投屏主控件。投屏界面是指安卓移动终端需要或实际显示在目标终端的界面。In the description of the present invention, the "screen projection" refers to transmitting the screen data of one terminal to another terminal for display. For the convenience of description, a terminal in this application refers to an Android mobile terminal. The other terminal mainly refers to electronic devices such as TVs and car center consoles (cars) that need to accept screen projections, hereinafter referred to as target terminals. The screen projection function may be provided by a computer system or an application. In this application, the screen projection function provided is called a screen projection main control. The screen-casting interface refers to the interface that the Android mobile terminal needs or actually displays on the target terminal.

周知的,程序界面的表现形式是图形用户界面(Graphic User Interface,以下简称GUI),是指采用图形方式显示的与计算机操作相关的用户界面。界面可以由图标、按钮、按钮组、选项区、对话框、提示框、进度条等可视的界面元素组成。这些可视的界面元素也称为应用程序界面的控件。事件是可以被控件识别的操作,如按下确定按钮,选择某个单选按钮或者复选框。每一种控件有自己可以识别的事件,如窗体的加载、单击、双击等事件,编辑框(文本框)的文本改变事件,等等。在本申请中涉及的名词以及相关技术原理所有解释或定义仅是进行示例性而非限定性说明。It is well known that the expression form of the program interface is a Graphic User Interface (Graphic User Interface, hereinafter referred to as GUI), which refers to a user interface related to computer operations displayed in a graphical manner. The interface can be composed of visual interface elements such as icons, buttons, button groups, option areas, dialog boxes, prompt boxes, and progress bars. These visual interface elements are also known as application interface controls. Events are actions that can be recognized by the control, such as pressing the OK button, selecting a radio button or checkbox. Each control has its own identifiable events, such as form loading, single-click, double-click and other events, edit box (text box) text change events, and so on. All explanations or definitions of terms and related technical principles involved in this application are only illustrative rather than limiting.

本发明在一个方面提供的一种可回控投屏方法,步骤包括:步骤S1.将安卓移动终端通过USB线连接目标终端;步骤S2.打开安卓移动终端的开发者模式;步骤S3.在目标终端通过ADB工具和安卓移动终端自带的app_process工具将一个控制事件输入服务程序在安卓移动终端作为后台服务运行起来,激活安卓移动终端的回控功能,所述控制事件输入服务程序用于接收来自目标终端的回控事件后往安卓移动终端注入控制事件;步骤S4.在WIFI投屏模式下,断开安卓移动终端与目标终端的有线连接。In one aspect of the present invention, a method for screen projection that can be controlled back is provided. The steps include: step S1. Connect the Android mobile terminal to the target terminal through a USB cable; step S2. open the developer mode of the Android mobile terminal; step S3. The terminal runs a control event input service program in the Android mobile terminal as a background service through the ADB tool and the app_process tool that comes with the Android mobile terminal, and activates the callback function of the Android mobile terminal. The control event is injected into the Android mobile terminal after the callback event of the target terminal; step S4. In the WIFI screen projection mode, the wired connection between the Android mobile terminal and the target terminal is disconnected.

本发明中由于通过app_process工具运行起来的后台服务程序具有很高的权限,所以作为后台服务程序的所述控制事件输入服务程序能够往安卓移动终端注入控制事件,使得在目标终端可以进行操作返回到安卓移动终端并对安卓移动终端进行同样的操作。在所述控制事件输入服务程序成功运行起来后,在WIFI投屏模式下就可以拔掉USB线,使得用户可以脱离有线连接的约束实现无线回控。In the present invention, since the background service program run by the app_process tool has high authority, the control event input service program as the background service program can inject control events into the Android mobile terminal, so that the target terminal can perform operations and return to Android mobile terminal and perform the same operation on the Android mobile terminal. After the control event input service program is successfully run, the USB cable can be unplugged in the WIFI screen projection mode, so that the user can realize wireless return control without the constraints of wired connection.

具体的,在所述步骤S2与步骤S3之间,在目标终端通过ADB工具往所述安卓移动终端推送所述控制事件输入服务程序。Specifically, between the step S2 and the step S3, the target terminal pushes the control event input service program to the Android mobile terminal through an ADB tool.

一个较好的实施例中,所述安卓移动终端为安卓手机或安卓智能平板。In a preferred embodiment, the Android mobile terminal is an Android mobile phone or an Android smart tablet.

在一个具体的实施情况里,所述目标终端为车机。In a specific implementation situation, the target terminal is a vehicle machine.

在一个可行的实施方案中,在所述步骤S3中所述控制事件输入服务程序往安卓移动终端注入控制事件的过程包括:步骤S31.设置所述控制事件输入服务程序的运行状态为True;步骤S32.所述控制事件输入服务程序初始化,然后创建Socket套接字,通过预设的目标终端IP和端口号与目标终端建立TCP连接;步骤S33.初始化所述控制事件输入服务程序的控制事件处理功能模块;步骤S34.开启第一子线程,当有控制流数据到来时通过反射机制调用“injectInputEvent”接口往所述安卓移动终端注入控制事件,实现在目标终端控制安卓移动终端的操作。In a feasible embodiment, the process of injecting control events into the Android mobile terminal by the control event input service program in the step S3 includes: step S31. Setting the running state of the control event input service program to True; step S32. Initialize the control event input service program, then create a Socket socket, and establish a TCP connection with the target terminal through the preset target terminal IP and port number; Step S33. Initialize the control event processing of the control event input service program Function module; Step S34. Start the first sub-thread, and use the reflection mechanism to call the "injectInputEvent" interface to inject control events into the Android mobile terminal when control flow data arrives, so as to realize the operation of controlling the Android mobile terminal on the target terminal.

具体的一个做法中,在步骤S34中,判断所述控制事件输入服务程序的运行状态,如果运行状态是True则阻塞等待接收控制流数据;如果运行状态不是True则结束所述第一子线程。In a specific method, in step S34, the running state of the control event input service program is judged, if the running state is True, the block waits to receive control flow data; if the running state is not True, the first sub-thread is terminated.

其中较佳的一个实施例中,在步骤S32与步骤S33之间,判断安卓移动终端与目标终端是否连接成功,如果连接成功则开始步骤S33;如果连接失败则设置所述控制事件输入程序的运行状态为False,睡眠预设时间后再次从步骤S1开始运行。In a preferred embodiment, between step S32 and step S33, it is determined whether the connection between the Android mobile terminal and the target terminal is successful, and if the connection is successful, step S33 is started; if the connection fails, the operation of the control event input program is set to run The state is False, and the operation starts from step S1 again after sleeping for a preset time.

其中还有一个较佳的实施例中,在步骤S31与步骤S32之间,开启第二子线程,在所述第二子线程里创建DatagramSocket套接字,每隔预设时间通过UDP端口向外广播“回控已激活”的消息。In another preferred embodiment, between step S31 and step S32, a second sub-thread is started, a DatagramSocket socket is created in the second sub-thread, and a socket is created through the UDP port every preset time. Broadcast a "Callback activated" message.

另一个较好的实施方案中,在步骤S4之后,当用户在安卓移动终端关闭USB调试开关,则所述控制事件输入服务程序结束运行。这时在目标终端上就不能再回控安卓移动终端。In another preferred embodiment, after step S4, when the user turns off the USB debugging switch on the Android mobile terminal, the control event input service program ends running. At this time, the Android mobile terminal cannot be controlled back on the target terminal.

还有一个可行的实施方案中,所述步骤S3中激活安卓移动终端的回控功能的具体过程包括:在目标终端开启一个子线程用来接收安卓移动终端的配对连接请求及激活回控操作的请求;当目标终端接收到安卓移动终端激活回控操作的请求,启动ADB工具去探测安卓移动终端是否已经通过USB线连接到目标终端,并检测安卓移动终端是否打开了USB调试开关;如果安卓移动终端通过USB线与目标终端连接并打开了USB调试开关,则将所述控制事件输入程序推送到安卓移动终端,并通过ADB工具在安卓移动终端的后台运行所述控制事件输入服务程序,将安卓移动终端的回控操作激活。In another feasible implementation, the specific process of activating the callback function of the Android mobile terminal in the step S3 includes: starting a sub-thread in the target terminal for receiving the pairing connection request of the Android mobile terminal and activating the callback operation. request; when the target terminal receives the request of the Android mobile terminal to activate the control operation, start the ADB tool to detect whether the Android mobile terminal has been connected to the target terminal through the USB cable, and detect whether the Android mobile terminal has turned on the USB debugging switch; The terminal is connected to the target terminal through a USB cable and the USB debugging switch is turned on, then the control event input program is pushed to the Android mobile terminal, and the control event input service program is run in the background of the Android mobile terminal through the ADB tool, and the Android The callback operation of the mobile terminal is activated.

这其中较好的一个做法里,所述步骤S3中激活安卓移动终端的回控功能的过程还包括:判断激活是否成功,如果激活成功则结束所述子线程;如果激活未成功,则再次尝试;尝试预设次数后如果仍不能激活则结束进程。In one of the better practices, the process of activating the callback function of the Android mobile terminal in the step S3 further includes: judging whether the activation is successful, if the activation is successful, the sub-thread is terminated; if the activation is unsuccessful, try again ; After trying the preset number of times, if it still cannot be activated, end the process.

在本发明的另一方面提供了一种程序产品,所述程序产品包括指令,所述指令在计算机上运行时,使得所述计算机执行上述可回控投屏方法。In another aspect of the present invention, a program product is provided, the program product includes instructions, and when the instructions are run on a computer, the instructions cause the computer to execute the above-mentioned reversible screen projection method.

在本发明还有一个方面提供了一种计算机可读存储介质,所述计算机可读存储介质包括计算机程序,当计算机程序运行时,使得计算机能够执行上述可回控投屏方法。In another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium includes a computer program, and when the computer program runs, the computer can execute the above-mentioned returnable screen projection method.

此外本发明还提供了一种可回控投屏装置,包括:安卓移动终端、目标终端和计算机程序;所述安卓移动终端与目标终端通信连接;所述安卓移动终端包括第一处理器、第一存储器;所述目标终端包括显示屏、操控部件、第二处理器和第二存储器;所述计算机程序包括ADB工具、app_process工具、控制事件输入服务程序和投屏服务程序;所述操控部件用于接收输入操作;所述显示屏用于显示投屏界面;所述第一存储器用于存储所述app_process工具和所述控制事件输入服务程序;所述第二存储器用于存储所述ADB工具和所述投屏服务程序;所述控制事件输入程序包括网络连接模块和控制事件处理模块;所述第一处理器用于执行以下操作:运行所述app_process工具将所述控制事件输入服务程序在后台运行;运行所述网络连接模块将安卓移动终端和所述目标终端建立通信连接;运行所述控制事件处理模块解析和处理从目标终端发送的控制流数据,然后在所述安卓移动终端注入相应的控制事件;所述投屏服务程序至少包括回控激活服务模块;所述第二处理器用于执行以下操作:运行所述回控激活服务模块向所述安卓移动终端发送控制流数据,实现回控操作的激活。In addition, the present invention also provides a screen projection device that can be controlled back, including: an Android mobile terminal, a target terminal and a computer program; the Android mobile terminal and the target terminal are communicatively connected; the Android mobile terminal includes a first processor, a third a memory; the target terminal includes a display screen, a control component, a second processor and a second memory; the computer program includes an ADB tool, an app_process tool, a control event input service program and a screen projection service program; the control component uses for receiving input operations; the display screen is used to display a screen projection interface; the first memory is used to store the app_process tool and the control event input service program; the second memory is used to store the ADB tool and the screen projection service program; the control event input program includes a network connection module and a control event processing module; the first processor is configured to perform the following operations: run the app_process tool to run the control event input service program in the background ; Run the network connection module to establish a communication connection between the Android mobile terminal and the target terminal; run the control event processing module to parse and process the control flow data sent from the target terminal, and then inject the corresponding control in the Android mobile terminal The screen projection service program at least includes a callback activation service module; the second processor is configured to perform the following operations: run the callback activation service module to send control flow data to the Android mobile terminal to realize the callback operation activation.

具体的一个实施例中,所述控制事件输入服务程序在后台运行时,所述第一处理器执行以下操作:设置所述控制事件输入服务程序的运行状态为True;初始化所述控制事件输入服务程序;运行所述网络连接模块创建Socket套接字,通过预设的目标终端IP和端口号与目标终端建立TCP连接;初始化所述控制事件处理模块,开启第一子线程;当有控制流数据到来时通过反射机制调用“injectInputEvent”接口往所述安卓移动终端注入控制事件,实现在目标终端控制安卓移动终端的操作。In a specific embodiment, when the control event input service program is running in the background, the first processor performs the following operations: setting the running state of the control event input service program to True; initializing the control event input service program program; run the network connection module to create a Socket socket, establish a TCP connection with the target terminal through the preset target terminal IP and port number; initialize the control event processing module, open the first sub-thread; when there is control flow data When it arrives, the "injectInputEvent" interface is invoked through the reflection mechanism to inject a control event into the Android mobile terminal, so as to realize the operation of controlling the Android mobile terminal on the target terminal.

可选的一个做法中,在开启所述第一子线程后,所述第一处理器还执行操作:判断所述控制事件输入服务程序的运行状态,如果运行状态是True则阻塞等待接收控制流数据;如果运行状态不是True则结束所述第一子线程。In an optional approach, after opening the first sub-thread, the first processor also performs an operation: judging the running state of the control event input service program, and if the running state is True, blocking and waiting to receive the control flow. Data; if the running state is not True, the first child thread is terminated.

其中的一个较好的实施例中,在初始化所述控制事件处理模块之前,所述第一处理器还执行操作:判断安卓移动终端与目标终端是否连接成功,如果连接成功则初始化所述控制事件处理模块;如果连接失败则设置所述控制事件输入程序的运行状态为False,睡眠预设时间后再次设置所述控制事件输入服务程序的运行状态为True。In a preferred embodiment, before initializing the control event processing module, the first processor further performs an operation: judging whether the connection between the Android mobile terminal and the target terminal is successful, and if the connection is successful, initializing the control event processing module; if the connection fails, set the running state of the control event input program to False, and set the running state of the control event input service program to True again after sleeping for a preset time.

其中还有一个较好的实施例中,在初始化所述控制事件输入服务程序之后,所述第一处理器还执行操作:运行所述网络连接模块开启第二子线程,在所述第二子线程里创建DatagramSocket套接字,每隔预设时间通过UDP端口向外广播“回控已激活”的消息。In another preferred embodiment, after initializing the control event input service program, the first processor further executes an operation: running the network connection module to start a second sub-thread, and in the second sub-thread A DatagramSocket socket is created in the thread, and a "return control activated" message is broadcast out through the UDP port every preset time.

在一个可行的实施例中,运行所述回控激活服务模块,所述第二处理器执行以下操作:在目标终端开启一个子线程用来接收安卓移动终端的配对连接请求及激活回控操作的请求;当有安卓移动终端激活回控操作的请求被接收到,启动ADB工具去探测安卓移动终端是否已经通过USB线连接到目标终端,并检测安卓移动终端是否打开了USB调试开关;如果安卓移动终端通过USB线与目标终端连接并打开了USB调试开关条件满足后,则将所述一个控制事件输入程序推送到安卓移动终端,并通过ADB工具在安卓移动终端的后台运执行所述控制事件输入服务程序,将安卓移动终端的回控操作激活。In a feasible embodiment, the callback activation service module is run, and the second processor performs the following operations: starting a sub-thread in the target terminal for receiving the pairing connection request of the Android mobile terminal and activating the callback operation. request; when a request for activating the callback operation of the Android mobile terminal is received, start the ADB tool to detect whether the Android mobile terminal has been connected to the target terminal through the USB cable, and detect whether the Android mobile terminal has turned on the USB debugging switch; After the terminal is connected to the target terminal through a USB cable and the USB debugging switch is turned on and the conditions are met, the control event input program is pushed to the Android mobile terminal, and the control event input program is executed in the background of the Android mobile terminal through the ADB tool. The service program activates the callback operation of the Android mobile terminal.

这其中可选的一个做法里,所述第二处理器还执行操作:判断读激活是否成功,如果激活成功则结束进程;如果激活未成功,则再次尝试;尝试预设次数后如果仍不能激活则结束进程。In an optional method, the second processor also performs an operation: judging whether the read activation is successful, and ending the process if the activation is successful; if the activation is unsuccessful, try again; if the activation still fails after a preset number of attempts end the process.

优选的,所述安卓移动终端是安卓手机或安卓智能平板;所述目标终端是车机。投屏功能应用在汽车中是较常见的场景,将安卓手机或安卓智能平板上的内容及其获取的互联网资源如导航地图、音乐播放器等通过投屏技术在车机显示屏上显示,通过上述可回控投屏方法实现用户操作车机的操控部件,例如旋钮、按键或者触摸屏,控制安卓手机或安卓智能平板,更容易操作,也有利于行车安全。Preferably, the Android mobile terminal is an Android mobile phone or an Android smart tablet; the target terminal is a car machine. It is a common scene to use the screen projection function in the car. The content on the Android phone or Android smart tablet and the obtained Internet resources such as navigation maps, music players, etc. are displayed on the car display screen through the screen projection technology. The above-mentioned reversible screen projection method enables the user to operate the control components of the vehicle, such as knobs, buttons or touch screens, to control the Android mobile phone or the Android smart tablet, which is easier to operate and is also conducive to driving safety.

本发明具有如下有益效果:根据本发明所涉及的一种可回控投屏方法,通过ADB工具和安卓移动终端自带的app_process工具实现在安卓移动终端后台运行控制事件输入程序,执行回控操作,可以绕开安卓移动终端投屏需要特定权限的问题,同时在WIFI投屏模式下,只需要打开开发者模式,激活回控功能后即可拔掉USB线,在目标终端操控安卓移动终端,使得安卓移动终端用户在回控投屏操作中不再受有线连接的束缚,操作更灵活,更便捷,改善了用户体验,有利于投屏技术的进一步普及推广。本发明的可回控投屏装置、及计算机存储介质因能够实现上述可回控投屏方法也具有相应优势。The present invention has the following beneficial effects: according to a method for screen projection that can be controlled back in the present invention, the control event input program is run in the background of the Android mobile terminal through the ADB tool and the app_process tool that comes with the Android mobile terminal, and the return control operation is performed. , you can bypass the problem that Android mobile terminal screencasting requires specific permissions. At the same time, in WIFI screencasting mode, you only need to open the developer mode, activate the callback function, and then unplug the USB cable to control the Android mobile terminal on the target terminal. The Android mobile terminal users are no longer bound by wired connections in the control screen projection operation, the operation is more flexible and convenient, the user experience is improved, and it is conducive to the further popularization and promotion of the screen projection technology. The reversible screen projection device and the computer storage medium of the present invention also have corresponding advantages because they can realize the above reversible screen projection method.

附图说明Description of drawings

图1是本发明实施例一中可回控投屏装置的示意图。FIG. 1 is a schematic diagram of a screen projection device that can be controlled back according to Embodiment 1 of the present invention.

图2是本发明实施例一中控制事件输入程序构成示意图。FIG. 2 is a schematic diagram of the structure of a control event input program in Embodiment 1 of the present invention.

图3是本发明实施例一中投屏服务程序构成示意图。FIG. 3 is a schematic diagram of the structure of a screen projection service program in Embodiment 1 of the present invention.

图4是本发明实施例一中可回控投屏方法的流程图。FIG. 4 is a flowchart of a method for reversible screen projection in Embodiment 1 of the present invention.

图5是本发明实施例一中控制事件输入程序的实现过程示意图。FIG. 5 is a schematic diagram of an implementation process of a control event input program in Embodiment 1 of the present invention.

图6是本发明实施例一中激活安卓移动终端的回控功能的示意图。FIG. 6 is a schematic diagram of activating the callback function of the Android mobile terminal in Embodiment 1 of the present invention.

图7是本发明实施例二中控制事件输入程序的实现过程示意图。FIG. 7 is a schematic diagram of an implementation process of a control event input program in Embodiment 2 of the present invention.

具体实施方式Detailed ways

本发明的上述和/或附加的方面和优点从结合下面附图对实施例的描述中将变得明显和容易理解。附图中,相同结构或功能的部分利用相同的附图标记来标记,出于显示清楚的原因必要时并不是所有示出的部分在全部附图中用所属的附图标记来标记。The above and/or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings. In the figures, parts of the same structure or function are marked with the same reference numerals, and for reasons of clarity of illustration, if necessary, not all shown parts are marked with the associated reference numerals in all the figures.

在本说明书中描述的“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。References in this specification to "one embodiment" or "some embodiments" and the like mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically emphasized otherwise.

如图1所示,在本发明的实施例一中,可回控投屏装置包括安卓移动终端和目标终端,具体实施例中的安卓移动终端以安卓手机10为一种示例进行说明,并不限定,也可以是安卓智能平板等其他基于安卓系统的移动终端;而目标终端以车机20为一种示例进行说明,并不限定,目标终端也可以是电视机或者电脑。,本实施例中车机20包括显示屏201和操控部件202,例如旋钮控制的中控设备。习知的,安卓手机10和车机20能够通过USB线连接,在实施例中,USB接口是符合USB标准规范的接口,具体可以是Mini USB接口、Micro USB接口、USB Type C接口等。在本发明的实施例中可回控投屏系统能够支持USB有线投屏模式,也支持WIFI无线投屏模式,本发明的可回控投屏装置既能够在USB有线投屏模式下实现回控操作,也能够在WIFI无线投屏模式下实现无线回控操作。在USB投屏模式下始终连接着USB线的情况下实现回控操作,只需要打开安卓手机10的开发者模式开关,用USB线连上车机的中控触摸显示屏20即可,本发明的实施例中以WIFI投屏模式下实现无线回控操作为主进行阐述。As shown in FIG. 1 , in the first embodiment of the present invention, the reversible screen projection device includes an Android mobile terminal and a target terminal. The Android mobile terminal in the specific embodiment is described by taking the Android mobile phone 10 as an example, and does not It can also be other mobile terminals based on the Android system such as Android smart tablet; and the target terminal is illustrated by taking the car machine 20 as an example, which is not limited, and the target terminal can also be a TV or a computer. In this embodiment, the vehicle 20 includes a display screen 201 and a control component 202, such as a central control device controlled by a knob. As is known, the Android mobile phone 10 and the car 20 can be connected through a USB cable. In the embodiment, the USB interface is an interface conforming to the USB standard specification, specifically a Mini USB interface, a Micro USB interface, and a USB Type C interface. In the embodiment of the present invention, the controllable screen projection system can support the USB wired screen projection mode and also support the WIFI wireless screen projection mode. The controllable screen projection device of the present invention can realize the return control in the USB wired screen projection mode. It can also realize wireless return control operation in WIFI wireless screen projection mode. In the USB screen projection mode, when the USB cable is always connected to realize the return control operation, it is only necessary to turn on the developer mode switch of the Android mobile phone 10 and connect the central control touch display screen 20 of the car with the USB cable. In the embodiment described above, the implementation of wireless return control operation in the WIFI screen projection mode is mainly described.

实施例中安卓手机10的投屏主控件是一个安卓手机端投屏APP,命名为ACarPlay。ACarPlay用于实现截取安卓手机10屏幕正在显示的数据,然后通过MediaCodec编码为H264数据流10D,通过WIFI网络(Socket)或者USB网络(LocalSocket)传输到显示屏201,实现手机投屏。In the embodiment, the main screen projection control of the Android mobile phone 10 is an Android mobile phone terminal screen projection APP named ACarPlay. ACarPlay is used to capture the data being displayed on the screen of the Android phone 10, and then encode it into H264 data stream 10D through MediaCodec, and transmit it to the display screen 201 through the WIFI network (Socket) or USB network (LocalSocket) to realize the screencasting of the mobile phone.

本实施例中如图1所示意,安卓手机10包括第一存储器101,第一处理器102;车机20还包括第二存储器203和第二处理器204。第一存储器101和第二存储器203都是计算机可读存储介质,可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令;第一处理器102通过运行存储在第一存储器101中的指令,第二处理器203通过运行存储在第二存储器203中的指令,能执行完成相应操作。可回控投屏装置还包括计算机程序,本实施例中包括存储在第一存储器101上的app_process工具和所述控制事件输入服务程序;存储在第二存储器203上的ADB工具和所述投屏服务程序。ADB工具和安卓系统自带的app_process工具在本领域较为常见,在此不特别展开阐述。In this embodiment, as shown in FIG. 1 , the Android phone 10 includes a first memory 101 and a first processor 102 ; the vehicle 20 further includes a second memory 203 and a second processor 204 . Both the first memory 101 and the second memory 203 are computer-readable storage media, which can be used to store computer-executable program codes, and the executable program codes include instructions; the first processor 102 is stored in the first memory 101 by running The second processor 203 can execute the instructions stored in the second memory 203 to complete corresponding operations. The controllable screen projection device further includes a computer program, and in this embodiment, it includes the app_process tool and the control event input service program stored in the first memory 101 ; the ADB tool and the screen projection stored in the second memory 203 service program. The ADB tool and the app_process tool that comes with the Android system are relatively common in this field, and will not be elaborated here.

所述控制事件输入程序用于通过通信WIFI网络(Socket)或者USB网络(LocalSocket)接收来自车机20的回控事件后往安卓手机10注入控制事件。本实施例中控制事件输入程序命名为“ACarPlayInputEventServer”。在下文中均以ACarPlayInputEventServer指代所述控制事件输入程序。实施例中ACarPlayInputEventServer如图2所示,包括网络连接模块11和控制事件处理模块12。The control event input program is used for injecting control events into the Android mobile phone 10 after receiving the feedback control events from the vehicle machine 20 through the communication WIFI network (Socket) or the USB network (LocalSocket). In this embodiment, the control event input program is named "ACarPlayInputEventServer". Hereinafter, the control event input program is referred to as ACarPlayInputEventServer. In the embodiment, the ACarPlayInputEventServer, as shown in FIG. 2 , includes a network connection module 11 and a control event processing module 12 .

所述投屏服务程序,如图3所示,本实施例中命名为ACarPlayServer,包括回控激活服务模块21,还包括手机配对连接服务模块、H264数据接收服务模块、H264数据解码服务模块、帧数据传输服务模块、触摸事件分发服务模块。为实现可回控投屏ACarPlayServer至少包括回控激活服务模块21,用于向所述安卓移动终端发送控制流数据,实现回控操作的激活,本实施例中ACarPlayServer包括的其他模块是本实施例较好的一个示例,并不限定,也可以有更多或更少的模块或根据具体应用场景包括其他特定功能模块。The screen projection service program, as shown in FIG. 3, is named ACarPlayServer in this embodiment, and includes a callback activation service module 21, a mobile phone pairing and connection service module, an H264 data receiving service module, an H264 data decoding service module, a frame Data transmission service module, touch event distribution service module. In order to realize the controllable screen projection, the ACarPlayServer includes at least a callback activation service module 21, which is used to send control flow data to the Android mobile terminal to realize the activation of the callback operation. The other modules included in the ACarPlayServer in this embodiment are the same as this embodiment A better example is not limited, and there may be more or less modules or other specific function modules according to specific application scenarios.

本实施例中的实现可回控投屏方法,如图4所示,包括步骤S1.将安卓手机10通过USB线连接车机20;步骤S2.打开安卓手机10的开发者模式;步骤S3.在车机20通过ADB工具和安卓手机10系统自带的app_process工具将ACarPlayInputEventServer在安卓手机10上作为后台服务程序运行起来,激活安卓手机10的回控功能,ACarPlayInputEventServer接收来自车机20的回控事件后往安卓手机10中注入控制事件;步骤S4.在WIFI投屏模式下,用户断开安卓手机10与车机20的有线连接。如此就能够实现无线可回控投屏,不用一直受数据线的束缚,在使用中可以在操控部件202上操作来控制安卓手机10,操作更灵活,便捷,用户投屏应用的体验更佳。The implementation of the reversible screen projection method in this embodiment, as shown in FIG. 4 , includes steps S1. Connecting the Android mobile phone 10 to the car machine 20 through a USB cable; Step S2. Turning on the developer mode of the Android mobile phone 10; Step S3. The ACarPlayInputEventServer is run on the Android phone 10 as a background service program through the ADB tool and the app_process tool that comes with the Android phone 10 system on the car device 20 to activate the callback function of the Android phone 10, and the ACarPlayInputEventServer receives the callback event from the car device 20 The control event is then injected into the Android phone 10 ; step S4 . In the WIFI screen projection mode, the user disconnects the wired connection between the Android phone 10 and the vehicle 20 . In this way, wireless and reversible screen projection can be realized without being bound by the data cable all the time, and the Android phone 10 can be controlled by operating on the control part 202 during use, the operation is more flexible and convenient, and the user experience of the screen projection application is better.

在还有一些实施例中,在上述步骤S4之后,使用过程中如果用户关闭安卓手机10的USB调试开关,则ACarPlayInputEventServer结束运行。这时通过操控部件202则不再能控制安卓手机10。In still other embodiments, after the above step S4, if the user turns off the USB debugging switch of the Android phone 10 during use, the ACarPlayInputEventServer ends running. At this time, the Android mobile phone 10 can no longer be controlled by the control component 202 .

实施例一中,本发明的可回控投屏装置实现上述可回控投屏方法是通过第一处理器102和第二处理器204执行操作完成的。第一处理器102用于执行以下操作:运行所述app_process工具将在ACarPlayInputEventServer后台运行;运行网络连接模块11将安卓手机10和车机20建立通信连接;运行控制事件处理模块12解析和处理从车机20发送的控制流数据20D,然后在安卓手机10注入相应的控制事件;第二处理器204用于执行以下操作:运行回控激活服务模块21向安卓手机10发送控制流数据20D,实现回控操作的激活。In the first embodiment, the reversible screen projection device of the present invention implements the above-mentioned reversible screen projection method by performing operations on the first processor 102 and the second processor 204 . The first processor 102 is configured to perform the following operations: run the app_process tool to run in the background of ACarPlayInputEventServer; run the network connection module 11 to establish a communication connection between the Android phone 10 and the vehicle 20; run the control event processing module 12 to parse and process slave vehicles The second processor 204 is configured to perform the following operations: run the callback activation service module 21 to send the control flow data 20D to the Android phone 10, and realize the return activation of the control operation.

结合参考图1,如图5所示,ACarPlayInputEventServer在后台运行时,第一处理器102执行以下操作:步骤S31.设置ACarPlayInputEventServer的运行状态为True;步骤S32.ACarPlayInputEventServer初始化,然后运行网络连接模块11创建Socket套接字,通过预设的车机20的IP和端口号和车机20建立TCP连接;步骤S33.初始化控制事件处理模块12;步骤S34.开启第一子线程,阻塞等待接收控制流数据20D,判断有无数据到来,如果没有则继续等待;当有控制流数据到来时通过反射机制调用“injectInputEvent”接口往安卓手机10注入控制事件,进而处理控制事件。With reference to Fig. 1, as shown in Fig. 5, when ACarPlayInputEventServer is running in the background, the first processor 102 performs the following operations: Step S31. Set the running state of ACarPlayInputEventServer to True; Step S32. ACarPlayInputEventServer is initialized, and then run the network connection module 11 to create Socket socket, establishes a TCP connection with the vehicle machine 20 through the preset IP and port number of the vehicle machine 20; Step S33. Initialize the control event processing module 12; Step S34. Open the first sub-thread, block and wait to receive control flow data 20D, determine whether there is data coming, if not, continue to wait; when there is control flow data, the "injectInputEvent" interface is called through the reflection mechanism to inject control events into the Android phone 10, and then process the control events.

在本实施例一些较好的做法中,在上述步骤S34中,第一处理器102还执行一个判断过程,判断ACarPlayInputEventServer的运行状态,如果运行状态为Ture,则继续阻塞等待接收控制流数据20D;如果运行状态不是Ture,而是False则结束所述第一子线程。这是本实施例较好的一个做法示例,并不限定本实施例其他可能的做法。In some preferred practices of this embodiment, in the above-mentioned step S34, the first processor 102 also performs a judgment process to judge the running state of the ACarPlayInputEventServer, and if the running state is True, then continue to block and wait to receive the control flow data 20D; If the running state is not True but False, the first sub-thread is terminated. This is an example of a better practice in this embodiment, and does not limit other possible practices in this embodiment.

本实施例中,第一处理器102执行操作,运行网络连接模块11和车机20建立端口号为“8886”的TCP连接,通过该TCP连接可以向车机20发送请求,也可以接收车机20发送过来的控制流数据20D。In this embodiment, the first processor 102 performs an operation to run the network connection module 11 and the vehicle 20 to establish a TCP connection with a port number of “8886”, and through the TCP connection, a request can be sent to the vehicle 20, and the vehicle 20 can also be received. 20 sends the control flow data 20D.

在本发明的其他一些实施例中,安卓手机10的第一存储器101中没有预先存储ACarPlayInputEventServer,在首次进行可回控投屏时用户也可以先将ACarPlayInputEventServer由车机20通过ADB工具推送到安卓手机10的第一存储器101中进行存储。本发明的情况并不以此为限定。In some other embodiments of the present invention, ACarPlayInputEventServer is not pre-stored in the first memory 101 of the Android mobile phone 10, and the user can also push the ACarPlayInputEventServer from the car device 20 to the Android mobile phone through the ADB tool when performing reversible screen projection for the first time. 10 is stored in the first memory 101. The case of the present invention is not limited to this.

在本实施例中,结合图1,第二处理器204运行回控激活服务模块21执行操作激活安卓手机10的回控功能的具体过程如图6所示,包括:在车机20开启一个“手机配对连接请求”子线程用来接收安卓手机10的配对连接请求及激活回控操作的请求,在实施例中该子线程开启的是端口号为“8886”的TCP socket服务,然后等待手机连接。这只是一个具体的实施例的连接做法,并不作为限定情况。当接收到安卓手机10激活回控操作的请求后,处理激活回控操作的请求,启动ADB工具去探测安卓手机10是否已经通过USB线连接到车机20,并检测安卓手机10是否打开了USB调试开关;如果上述结果为否则返回,继续等待手机连接;当条件满足后,将ACarPlayInputEventServer推送到安卓手机10。也有些实施例中ACarPlayInputEventServer预先已经存储在安卓手机10的第一存储器101中,则没有推送。通过ADB工具在安卓手机10后台运行ACarPlayInputEventServer,从而将安卓手机10的回控操作激活。In this embodiment, with reference to FIG. 1 , the specific process of the second processor 204 running the callback activation service module 21 to perform operations to activate the callback function of the Android mobile phone 10 is shown in FIG. The "Mobile phone pairing connection request" sub-thread is used to receive the pairing connection request of the Android mobile phone 10 and the request to activate the callback operation. In the embodiment, what the sub-thread opens is the TCP socket service with the port number "8886", and then waits for the mobile phone to connect. . This is only a connection method of a specific embodiment, and is not intended to be a limiting situation. After receiving the request of the Android phone 10 to activate the callback operation, process the request to activate the callback operation, start the ADB tool to detect whether the Android phone 10 has been connected to the vehicle 20 through the USB cable, and detect whether the Android phone 10 has opened the USB Debug switch; if the above result is otherwise, return, continue to wait for the mobile phone to connect; when the conditions are met, push the ACarPlayInputEventServer to the Android phone 10. In some embodiments, the ACarPlayInputEventServer has been stored in the first memory 101 of the Android mobile phone 10 in advance, so it is not pushed. The ACarPlayInputEventServer is run in the background of the Android phone 10 through the ADB tool, thereby activating the callback operation of the Android phone 10.

本实施例中一些较好的做法中,激活安卓手机10的回控功能的具体过程中第二处理器204还执行以下操作:判断激活是否成功,如果激活成功则结束进程;如果激活未成功,则再次尝试;尝试预设次数后如果仍不能激活则结束进程。具体的本实施例中设定尝试10次后退出,也可以根据实际情况设定更少或者更多的次数配合适用场景或具体需求。In some preferred practices in this embodiment, the second processor 204 also performs the following operations during the specific process of activating the callback function of the Android phone 10: judging whether the activation is successful, and ending the process if the activation is successful; if the activation is unsuccessful, Then try again; if it still fails to activate after the preset number of attempts, end the process. Specifically, in this embodiment, it is set to quit after 10 attempts, and it is also possible to set fewer or more times according to the actual situation to meet the applicable scenarios or specific needs.

实施例二与实施例一的主要区别在于第一处理器102运行ACarPlayInputEventServer执行操作的过程。结合参考图1,如图7所示,本实施例中在初始化ACarPlayInputEventServer之后,第一处理器102还执行操作:步骤S31’.运行网络连接模块11开启第二子线程,在第二子线程里创建DatagramSocket套接字,每隔预设时间通过UDP端口向外广播“回控已激活”的消息。本实施例中UDP端口号是“8885”。具体的预设时间在实施例中是1秒,也可以是2秒,或者根据实际情况预设的时间。目的在于让ACarPlay知道ACarPlayInputEventServer后台运行的状态。The main difference between the second embodiment and the first embodiment is that the first processor 102 runs the ACarPlayInputEventServer to perform operations. With reference to FIG. 1, as shown in FIG. 7, after initializing ACarPlayInputEventServer in this embodiment, the first processor 102 also performs the operation: step S31'. Run the network connection module 11 to open the second sub-thread, in the second sub-thread Creates a DatagramSocket socket and broadcasts a "backward control activated" message through the UDP port every preset time. In this embodiment, the UDP port number is "8885". The specific preset time is 1 second in the embodiment, or 2 seconds, or a preset time according to the actual situation. The purpose is to let ACarPlay know the status of ACarPlayInputEventServer running in the background.

在本实施例中,在初始化控制事件处理模块12之前,第一处理器还执行操作:步骤S32’.判断安卓手机10与车机20是否连接成功,如果连接成功则初始化控制事件处理模块12;如果连接失败则设置ACarPlayInputEventServer的运行状态为False,睡眠1秒钟后再次设置ACarPlayInputEventServer运行状态为True尝试继续运行,也有的实施例中是睡眠2秒钟或者其他根据实际情况预设的时间。In this embodiment, before initializing the control event processing module 12, the first processor also performs operations: step S32'. Determine whether the Android mobile phone 10 and the vehicle 20 are successfully connected, and if the connection is successful, initialize the control event processing module 12; If the connection fails, set the running state of ACarPlayInputEventServer to False, and set the running state of ACarPlayInputEventServer to True again after sleeping for 1 second to try to continue running. In some embodiments, it sleeps for 2 seconds or other preset time according to the actual situation.

上述实施方式为本发明的优选案例,并不用来限制本发明的保护范围。为明确说明起见,许多实施上的细节在以上叙述中一并说明。然而,应了解到,这些实施中的细节不应用以限制本发明。此外,为简化图式起见,一些结构与组件在图式中将以简单的示意的方式绘示之,这些仅是示意,并不限定特定实际可能的设计情况。The above-mentioned embodiments are preferred cases of the present invention, and are not intended to limit the protection scope of the present invention. For the sake of clarity, many implementation details are set forth in the above description. It should be understood, however, that details in these implementations should not be used to limit the invention. In addition, for the purpose of simplifying the drawings, some structures and components are shown in a simple schematic manner in the drawings, which are only schematic and do not limit a specific practical possible design situation.

另外,在本发明中如涉及“第一”、“第二”等的描述仅用于描述目的,并非特别指称次序或顺位的意思,亦非用以限定本发明,其仅仅是为了区别以相同技术用语描述的组件或操作而已,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。In addition, descriptions such as “first”, “second”, etc. in the present invention are only for the purpose of description, and do not refer to the meaning of order or sequence, nor are they used to limit the present invention. The components or operations are described by the same technical terms, and should not be construed as indicating or implying their relative importance or implying the quantity of the indicated technical features.

各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。The technical solutions between the various embodiments can be combined with each other, but must be based on the realization by those of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that the combination of technical solutions does not exist, and It is not within the scope of protection claimed by the present invention.

Claims (20)

1. A method for controllable screen projection is characterized in that: the method comprises the following steps:
s1, connecting an android mobile terminal with a target terminal through a USB (universal serial bus) line;
s2, opening a developer mode of the android mobile terminal;
s3, operating a control event input service program on the android mobile terminal as a background service through an ADB tool and an app _ process tool of the android mobile terminal at the target terminal, and activating a back control function of the android mobile terminal, wherein the control event input service program is used for injecting a control event into the android mobile terminal after receiving the back control event from the target terminal;
and S4, disconnecting the wired connection between the android mobile terminal and the target terminal in the WIFI screen projection mode.
2. The method of claim 1, wherein: between the step S2 and the step S3, the control event input service program is pushed to the android mobile terminal by the target terminal through the ADB tool.
3. The method of claim 1, wherein: in step S3, the process of injecting the control event into the android mobile terminal by the control event input service program includes:
s31, setting the running state of the control event input service program to be True;
s32, initializing the control event input service program, then creating a Socket, and establishing TCP connection with a target terminal through a preset target terminal IP and a port number;
s33, initializing a control event processing function module of the control event input service program;
and S34, starting the first sub-thread, and when control stream data arrives, calling an 'injectInputEvent' interface to inject a control event into the android mobile terminal through a reflection mechanism, so as to control the operation of the android mobile terminal at the target terminal.
4. The method of claim 3, wherein: in step S34, determining the running state of the control event input service program, and if the running state is True, blocking waiting for receiving control flow data; ending the first child thread if the running state is not True.
5. The method of claim 3, wherein: between the step S32 and the step S33, determining whether the connection between the android mobile terminal and the target terminal is successful, and if the connection is successful, starting a step S33; if the connection fails, the operation state of the control event input program is set to False, and the operation is started again from step S1 after the sleep preset time.
6. The method of claim 3, wherein: between the step S31 and the step S32, a second sub-thread is opened, a DatagramSocket is created in the second sub-thread, and a message of "back control activated" is broadcast to the outside through a UDP port at preset intervals.
7. The method of any one of claims 1 to 6, wherein: after step S4, when the user turns off the USB debug switch at the android mobile terminal, the control event input service program ends running.
8. The method of any one of claims 1 to 6, wherein: the specific process of activating the callback function of the android mobile terminal in the step S3 includes:
starting a sub thread at a target terminal to receive a pairing connection request of the android mobile terminal and a request for activating a back control operation;
when the target terminal receives a request of activating a back control operation of the android mobile terminal, starting an ADB tool to detect whether the android mobile terminal is connected to the target terminal through a USB line or not, and detecting whether the android mobile terminal turns on a USB debugging switch or not;
and if the android mobile terminal is connected with the target terminal through a USB line and the USB debugging switch is turned on, pushing the control event input program to the android mobile terminal, running the control event input service program on a background of the android mobile terminal through an ADB tool, and activating the back control operation of the android mobile terminal.
9. The method of claim 8, wherein: the process of activating the callback function of the android mobile terminal in step S3 further includes: judging whether the activation is successful, and if the activation is successful, ending the sub-thread; if the activation is not successful, try again; the process ends if it is still not active after a preset number of attempts.
10. The method of any one of claims 1 to 6, wherein: the android mobile terminal is an android mobile phone or an android intelligent tablet.
11. The method of any one of claims 1 to 6, wherein: the target terminal is a vehicle machine.
12. A computer-readable storage medium characterized by: the computer-readable storage medium comprises a computer program which, when executed, enables a computer having the computer program to perform the method of any of claims 1-11.
13. A screen device is thrown in controllable backtracking which characterized in that: the method comprises the following steps:
an android mobile terminal, a target terminal and a computer program; the android mobile terminal is in communication connection with a target terminal;
the android mobile terminal comprises a first processor and a first memory; the target terminal comprises a display screen, a control component, a second processor and a second memory; the computer program comprises an ADB tool, an app _ process tool, a control event input service program and a screen projection service program;
the control component is used for receiving input operation; the display screen is used for displaying a screen projection interface;
the first memory is used for storing the app _ process tool and the control event input service program; the second memory is used for storing the ADB tool and the screen projection service program;
the control event input program comprises a network connection module and a control event processing module; the first processor is configured to perform the following operations:
running the app _ process tool to input the control event into a service program to run in the background;
operating the network connection module to establish communication connection between the android mobile terminal and the target terminal; the control event processing module is operated to analyze and process control flow data sent from a target terminal, and then a corresponding control event is injected into the android mobile terminal;
the screen projection service program at least comprises a back control activation service module; the second processor is configured to: and operating the back control activation service module to send control flow data to the android mobile terminal to realize activation of back control operation.
14. A controllable screen-projecting device according to claim 13, wherein: when the control event input service program runs in the background, the first processor performs the following operations:
setting the running state of the control event input service program to True; initializing the control event input service program;
operating the network connection module to create Socket sockets, and establishing TCP connection with a target terminal through a preset target terminal IP and a preset port number;
initializing the control event processing module and starting a first sub-thread;
when control stream data comes, an injectInputEvent interface is called through a reflection mechanism to inject a control event into the android mobile terminal, and the operation of the android mobile terminal is controlled at a target terminal.
15. A controllable screen-projecting device according to claim 14, wherein: after the first child thread is opened, the first processor further performs the operations of:
judging the running state of the control event input service program, and if the running state is True, blocking and waiting for receiving control flow data; and if the running state is not True, ending the first sub-thread.
16. A controllable screen-projecting device according to claim 14, wherein: prior to initializing the control event processing module, the first processor further performs the operations of:
judging whether the connection between the android mobile terminal and the target terminal is successful, and initializing the control event processing module if the connection is successful; and if the connection fails, setting the running state of the control event input program to False, and setting the running state of the control event input service program to True again after sleeping for preset time.
17. A controllable screen-projecting device according to claim 14, wherein: after initializing the control event input service, the first processor further performs the operations of: and operating the network connection module to start a second sub-thread, creating a DatagramSocket socket in the second sub-thread, and broadcasting a message of 'response control activated' outwards through a UDP port at preset intervals.
18. A controllable screen-projecting device according to claim 13 or 14, wherein: the second processor executes the back control activation service module and performs the following operations: starting a sub thread at a target terminal to receive a pairing connection request of an android mobile terminal and a request for activating a back control operation;
when a request for activating a callback operation of the android mobile terminal is received, starting an ADB tool to detect whether the android mobile terminal is connected to a target terminal through a USB line or not and detect whether the android mobile terminal is turned on a USB debugging switch or not;
and if the android mobile terminal is connected with the target terminal through a USB line and the USB debugging switch is turned on to meet the conditions, pushing the control event input program to the android mobile terminal, executing the control event input service program in the background of the android mobile terminal through an ADB tool, and activating the back control operation of the android mobile terminal.
19. A controllable screen-projecting device according to claim 18, wherein: the second processor further performs the operations of: judging whether the activation is successful, and if the activation is successful, ending the sub-thread; if the activation is not successful, try again; the process ends if it is still not active after a preset number of attempts.
20. A controllable screen-projecting device according to any of claims 13-17, wherein: the android mobile terminal is an android mobile phone or an android smart tablet; the target terminal is a car machine.
CN202011381181.9A 2020-11-30 2020-11-30 Method, computer readable storage medium and device for controlling screen projection in backward mode Pending CN114584815A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011381181.9A CN114584815A (en) 2020-11-30 2020-11-30 Method, computer readable storage medium and device for controlling screen projection in backward mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011381181.9A CN114584815A (en) 2020-11-30 2020-11-30 Method, computer readable storage medium and device for controlling screen projection in backward mode

Publications (1)

Publication Number Publication Date
CN114584815A true CN114584815A (en) 2022-06-03

Family

ID=81767729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011381181.9A Pending CN114584815A (en) 2020-11-30 2020-11-30 Method, computer readable storage medium and device for controlling screen projection in backward mode

Country Status (1)

Country Link
CN (1) CN114584815A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118939217A (en) * 2024-07-29 2024-11-12 广东保伦电子股份有限公司 A method, device and system for controlling mirror screen projection of an Android terminal

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6559883B1 (en) * 2000-09-27 2003-05-06 David H. Sitrick Movie film security system utilizing infrared patterns
CN103002155A (en) * 2012-12-13 2013-03-27 江苏诚迈科技有限公司 Method for deploying Android mobile phone by using vehicle-mounted terminal
CN104333844A (en) * 2014-11-12 2015-02-04 沈阳美行科技有限公司 Interconnection method of vehicle-mounted terminal and smart phone
CN104391695A (en) * 2014-11-06 2015-03-04 北京凌阳益辉科技有限公司 Method for performing synchronous control through external equipment and device thereof
US20160085699A1 (en) * 2013-05-20 2016-03-24 Zte Corporation Enabling method and enabling device for debugging port of terminal, and terminal
CN106027808A (en) * 2016-07-28 2016-10-12 上海博泰悦臻电子设备制造有限公司 A car machine, an intelligent mobile terminal, and a corresponding connection control method and system
WO2016206528A1 (en) * 2015-06-26 2016-12-29 飞天诚信科技股份有限公司 Method for implementing automatic bluetooth reconnection in android system
WO2017101419A1 (en) * 2015-12-15 2017-06-22 乐视控股(北京)有限公司 Screen projection method
CN108255677A (en) * 2018-01-16 2018-07-06 中电福富信息科技有限公司 The vehicle-mounted vehicle device of car networking and Android device communication means and its device
CN108536491A (en) * 2018-02-07 2018-09-14 武汉光庭信息技术股份有限公司 A kind of processing method and system of mobile unit Reverse Turning Control Android mobile terminal

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6559883B1 (en) * 2000-09-27 2003-05-06 David H. Sitrick Movie film security system utilizing infrared patterns
CN103002155A (en) * 2012-12-13 2013-03-27 江苏诚迈科技有限公司 Method for deploying Android mobile phone by using vehicle-mounted terminal
US20160085699A1 (en) * 2013-05-20 2016-03-24 Zte Corporation Enabling method and enabling device for debugging port of terminal, and terminal
CN104391695A (en) * 2014-11-06 2015-03-04 北京凌阳益辉科技有限公司 Method for performing synchronous control through external equipment and device thereof
CN104333844A (en) * 2014-11-12 2015-02-04 沈阳美行科技有限公司 Interconnection method of vehicle-mounted terminal and smart phone
WO2016206528A1 (en) * 2015-06-26 2016-12-29 飞天诚信科技股份有限公司 Method for implementing automatic bluetooth reconnection in android system
WO2017101419A1 (en) * 2015-12-15 2017-06-22 乐视控股(北京)有限公司 Screen projection method
CN106027808A (en) * 2016-07-28 2016-10-12 上海博泰悦臻电子设备制造有限公司 A car machine, an intelligent mobile terminal, and a corresponding connection control method and system
CN108255677A (en) * 2018-01-16 2018-07-06 中电福富信息科技有限公司 The vehicle-mounted vehicle device of car networking and Android device communication means and its device
CN108536491A (en) * 2018-02-07 2018-09-14 武汉光庭信息技术股份有限公司 A kind of processing method and system of mobile unit Reverse Turning Control Android mobile terminal

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118939217A (en) * 2024-07-29 2024-11-12 广东保伦电子股份有限公司 A method, device and system for controlling mirror screen projection of an Android terminal

Similar Documents

Publication Publication Date Title
CN103309308B (en) A kind of device intelligence control method and device, system, PnP device
US10104599B2 (en) Device binding methods and apparatuses
CN102802071B (en) Intelligent television, mobile terminal, multi-screen interaction system and wireless communication method
EP3397018A1 (en) Information processing method, program, and information processing system
CN104967971A (en) A method of realizing automatic reconnection of bluetooth under Android system
WO2010129130A1 (en) Remote control signal learning and processing by a host device and accessory
CN113992958B (en) Multi-window same-screen interaction method, terminal and storage medium
JP7018110B1 (en) Mobile device dock
CN104780429A (en) Anti-interfering Bluetooth pairing method, main device with anti-interfering Bluetooth pairing function, anti-interfering Bluetooth pairing system, and Bluetooth pairing method thereof
KR101249719B1 (en) Method for executing clone applications, computer readable recording medium for the same, and clone devices for the same
CN113407427A (en) Verification information processing method and device, terminal equipment and storage medium
US12452476B2 (en) Display apparatus, terminal device and communication connection method
CN106101836A (en) The player method of intelligent television and device
CN115052279B (en) Pairing method and device of wireless screen transmitter
CN114584815A (en) Method, computer readable storage medium and device for controlling screen projection in backward mode
CN115277276B (en) Program upgrading method and device for air conditioner, air conditioning system and storage medium
CN114489548A (en) Information sharing method and device, screen projector and computer readable storage medium
CN115150645B (en) Display equipment and display method of screen throwing function page
WO2018045882A1 (en) Method and system for controlling soft operational key of application of intelligent terminal
CN115776658B (en) Display device and method for establishing Bluetooth connection with control device
CN114968456B (en) Method and device for controlling terminal
CN115767486B (en) Bluetooth communication method, first device, second device and storage medium
CN114579217A (en) A content-definable screen projection device, method and computer-readable storage medium
CN118891879A (en) Display equipment and processing method for display equipment
CN108469107B (en) Air conditioner control method and device, air conditioner and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20220603

RJ01 Rejection of invention patent application after publication