Method, device, storage medium and equipment based on protocol agent management SDK
By integrating a protocol proxy management SDK into smart home devices, which receives and parses broadcast data packets, dynamic management of third-party SDKs is achieved, solving the problem of SDK resource consumption and improving device performance and security.
Patent Information
- Application Number
- CN202211652278.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-12-21
AI Technical Summary
In smart home devices, third-party SDKs run continuously after the application starts, consuming memory and CPU resources, affecting device performance, and posing security risks.
By integrating a protocol proxy into smart home devices, broadcast data packets from mobile terminals are received and parsed. The startup and shutdown of third-party SDKs are managed according to the data packet type, including configuring SDK enablement status information in the cloud server to ensure security.
Effectively manage the running status of third-party SDKs, avoid resource waste, improve device performance and stability, and prevent security risks.
Smart Images

Figure CN115955368B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of smart home, and particularly relates to a method and device for managing SDK based on a protocol agent, a storage medium and a smart home device. BACKGROUND
[0002] With the continuous development of technology, the smart home device carries not only the original function, but also various expansion functions. For example, for a smart TV, it carries not only the function of watching TV programs, but also the functions of screen projection, game, shopping, etc.
[0003] For a smart home device manufacturer, it is not possible for the smart home device such as a smart TV to independently develop all the functions, so some third-party software development kits (SDKs) are introduced to realize the corresponding functions. Generally, the third-party SDKs are directly integrated into the application, but this will cause some problems, such as the third-party SDKs exist after the application is started, even if the functions supported by the third-party SDKs are not used, so the memory, CPU, etc. of the smart home device are occupied, which seriously affects the performance of the smart home device. SUMMARY
[0004] The embodiments of the present application provide a method and device for managing SDK based on a protocol agent, a storage medium and a smart home device, which can realize the start and stop of a target SDK to be managed through a protocol agent, so as to avoid the target SDK to be managed existing after the application is started and occupying the resources of the smart home device.
[0005] The embodiments of the present application provide a method for managing SDK based on a protocol agent, which is applied to a smart home device and includes the following steps.
[0006] Starting a protocol agent in the smart home device;
[0007] Receiving a broadcast data packet broadcasted by a mobile terminal in a same local area network through the protocol agent, the broadcast data packet being encapsulated according to a protocol rule supported by the protocol agent, and the broadcast data packet being generated by the mobile terminal in response to a preset operation on an application in the smart home device;
[0008] Analyzing the broadcast data packet through the protocol agent to obtain a SDK type to be managed and a management type, the management type corresponding to the preset operation;
[0009] Determining a target SDK to be managed according to the SDK type to be managed, the target SDK to be managed belonging to an SDK of the application;
[0010] The management module is configured to invoke, through the protocol agent, a management interface in the target SDK to be managed that matches the management type, and execute a computer program in the management interface to implement management of the target SDK to be managed, the management including starting and closing.
[0011] The embodiment of the present application further provides an apparatus for managing an SDK based on a protocol agent, which is applied to a smart home device and comprises:
[0012] The starting module is configured to start a protocol agent in the smart home device.
[0013] The receiving module is configured to receive a broadcast data packet broadcast by a mobile terminal in a same local area network through the protocol agent, the broadcast data packet being encapsulated according to a protocol rule supported by the protocol agent, and the broadcast data packet being generated by the mobile terminal in response to a preset operation on an application in the smart home device.
[0014] The parsing module is configured to parse the broadcast data packet through the protocol agent to obtain a SDK type to be managed and a management type, the management type corresponding to the preset operation.
[0015] The determining module is configured to determine a target SDK to be managed according to the SDK type to be managed, the target SDK to be managed belonging to an SDK of the application.
[0016] The management module is configured to invoke, through the protocol agent, a management interface in the target SDK to be managed that matches the management type, and execute a computer program in the management interface to implement management of the target SDK to be managed, the management including starting and closing.
[0017] The embodiment of the present application further provides a computer readable storage medium, wherein a plurality of instructions are stored in the computer readable storage medium, and the instructions are suitable for being loaded by a processor to execute any one of the above SDK management methods based on a protocol agent.
[0018] The embodiment of the present application further provides a smart home device, comprising a processor and a memory, wherein the processor is electrically connected with the memory, the memory is configured to store instructions and data, and the processor is configured to execute steps in any one of the above SDK management methods based on a protocol agent.
[0019] The application provides a protocol agent management SDK-based method, device, storage medium and smart home equipment. BRIEF DESCRIPTION OF DRAWINGS
[0020] The technical scheme and other beneficial effects of the application will be apparent through the following detailed description of the specific embodiments of the application combined with the drawings.
[0021] Figure 1 The application provides an application scenario diagram for the embodiments of the application.
[0022] Figure 2 The application provides a flowchart of the protocol agent management SDK-based method for the embodiments of the application.
[0023] Figure 3 The application provides a flowchart of the protocol agent management SDK-based method for the embodiments of the application.
[0024] Figure 4 The application provides another flowchart of the protocol agent management SDK-based method for the embodiments of the application.
[0025] Figure 5 The application provides an application diagram of the protocol agent management SDK-based method for the embodiments of the application.
[0026] Figure 6 The application provides a structural diagram of the protocol agent management SDK-based device for the embodiments of the application.
[0027] Figure 7 The application provides a structural diagram of the smart home equipment for the embodiments of the application.
[0028] Figure 8Another structural schematic diagram of the smart home device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0030] The embodiments of the present application provide a method and device for managing SDK based on protocol agent, a storage medium and a smart home device. Any method for managing SDK based on protocol agent or device for managing SDK based on protocol agent provided in the embodiments of the present application can be integrated in a smart home device, which can include smart TV, smart robot, smart air conditioner, smart refrigerator, smart vehicle-mounted device, wearable device, smart camera and various types of smart devices.
[0031] The smart home device is installed with an application (also referred to as application program), and the application is integrated with one or more third-party SDKs, wherein, any SDK that is not independently developed by the manufacturer of the smart home device belongs to the third-party SDK. The mobile terminal in the embodiments of the present application includes smart phone, Pad (tablet computer), palm computer, smart remote controller and other devices. The mobile terminal is integrated with a corresponding application matching the application in the smart home device, or the mobile terminal is integrated with an application interface corresponding to the application in the smart home device, and the application and / or third-party SDK in the smart home device are started or closed by calling the application interface. The SDK, SDK to be managed or target SDK to be managed described below are all third-party SDKs.
[0032] Before introducing the specific scheme in the embodiments of the present application, the current scheme is further introduced. In the current scheme, when the smart home device introduces a third-party SDK, the third-party SDK is integrated in the application, and when the application is started, the third-party SDK is always in a starting running state. However, the third-party SDK is not needed by the smart home device every moment, and is only needed in some application scenarios. The always starting running state will occupy the memory, CPU and other resources of the smart home device. Moreover, when the application integrates the third-party SDK, if no security verification is performed, or when the third-party SDK is upgraded, security risks may occur, for example, the third-party SDK crashes, which will cause the application of the smart home device to be unable to use, or the third-party SDK may infringe the user's privacy, so as to destroy the security and stability of the smart home device. In addition, in the current scheme, when the mobile terminal needs to access the smart home device, since the third-party SDK is always in an enabled state, the mobile terminal usually directly accesses the third-party SDK to realize communication with the smart home device.
[0033] Figure 1 is an application scenario provided by the embodiments of the present application, which includes a smart home device and a mobile terminal, and in some embodiments, further includes a cloud server of the smart home device. The smart home device and the mobile terminal are located in the same local area network, the smart home device and the mobile terminal communicate, and the smart home device and the cloud server communicate.
[0034] A protocol agent is integrated in the smart home device, and the protocol agent is started. When the mobile terminal responds to a preset operation on the application in the smart home device, a broadcast data packet is generated according to a protocol rule supported by the protocol agent, and the broadcast data packet is broadcasted in the local area network. The protocol agent receives the broadcast data packet broadcasted by the mobile terminal, and parses the broadcast data packet to obtain a to-be-managed SDK type and a management type. The management type corresponds to the preset operation. A target to-be-managed SDK is determined according to the to-be-managed SDK type. The target to-be-managed SDK belongs to the SDK of the application. A management interface in the target to-be-managed SDK that matches the management type is called through the protocol agent, and a computer program in the management interface is executed to realize management of the target to-be-managed SDK. The management includes starting and closing. In this way, starting and closing of the target to-be-managed SDK are realized through the protocol agent, so as to avoid that the target to-be-managed SDK always occupies the resources of the smart home device after the application is started.
[0035] In an embodiment, in the case of starting the target SDK to be managed, after the protocol agent parses the broadcast data packet to obtain the SDK type to be managed, and determines the target SDK to be managed according to the SDK type to be managed, the protocol agent further requests the target starting state information of the target SDK to be managed from the cloud server, when the target starting state information in the cloud server indicates that the target SDK to be managed can be started, the protocol agent calls the management interface matching the management type in the target SDK to be managed, otherwise, when the target starting state information in the cloud server indicates that the target SDK to be managed cannot be started, the protocol agent discards the broadcast data packet.
[0036] The smart home device in the embodiments of the present application is taken as an example of a smart television for illustration.
[0037] Figure 2 FIG. 1 is a flowchart of a method for managing an SDK based on a protocol agent provided in the embodiments of the present application, which is applied to a smart home device, and includes the following steps.
[0038] 101, starting the protocol agent in the smart home device.
[0039] The protocol agent in the embodiments of the present application is a broadcast receiving processing tool or a broadcast receiving processor realized by computer program code, for example, a UDP (User Datagram Protocol) broadcast receiving processing tool or a UDP broadcast receiving processor. The protocol agent can realize receiving a broadcast data packet, parsing the broadcast data packet, and managing the SDK to be managed through the protocol agent, for example, starting or closing the corresponding SDK to be managed.
[0040] The protocol agent is integrated or installed in the smart home device, such as a smart television, and the protocol agent in the smart home device is started. For example, the protocol agent can be started when the smart home device is started.
[0041] 102, receiving a broadcast data packet broadcast by a mobile terminal in the same local area network through the protocol agent, the broadcast data packet is encapsulated according to the protocol rule supported by the protocol agent, and the broadcast data packet is generated by the mobile terminal in response to a preset operation on an application in the smart home device.
[0042] The broadcast data packet is generated by the mobile terminal, and the mobile terminal generates the broadcast data packet in response to a preset operation on an application in the smart home device. Since the mobile terminal and the smart home device are in the same local area network, the protocol agent of the smart home device can receive the broadcast data packet. It should be noted that in the current scheme, the to-be-managed SDK of the smart home device is always in a start running state, so the mobile terminal can directly access the to-be-managed SDK through the corresponding application or application interface, thereby realizing communication between the mobile terminal and the smart home device such as a smart television, without sending a broadcast data packet.
[0043] The broadcast data packet is encapsulated according to the protocol rules supported by the protocol agent, for example, the protocol rules supported by the protocol agent include the following fields: flag bit, SDK type, broadcast address, extension field, and the like. For example, the flag bit can occupy 1 bit, the SDK type can occupy 32 bits, the broadcast address can occupy 32 bits, the extension field can occupy 32 bits, and the like, or other bit numbers. The extension field is a field reserved for implementing custom functions, for example, the extension field includes mobile terminal model, application version number, or other field data that can be used for burying points, and the like, and the broadcast address refers to the IP address and the like of the mobile terminal.
[0044] Most importantly, the flag bit and the SDK type field. The content of the flag bit field corresponds to the management type, and the content of the flag bit field can be 1 and 0 respectively, wherein 1 indicates start, that is, the broadcast data packet is a start data packet, and 0 indicates close, that is, the broadcast data packet is a close data packet, and the content of the flag bit field can be other content that can distinguish the two different cases. The content of the SDK type field corresponds to the to-be-managed SDK type, and the content of the SDK type field can be information indicating the type of the SDK to be started or closed, or the number of the SDK to be started or closed, and the like, wherein the information in the SDK type field includes information that can indicate one or more SDKs. Understandably, an application includes one or more SDKs.
[0045] The broadcast data packet is a UDP data packet of the UDP format supported by the protocol agent and includes the above-mentioned fields.
[0046] Since the corresponding application matching the application in the smart home device is integrated in the mobile terminal or the application interface corresponding to the application of the smart home device is integrated in the mobile terminal. The corresponding application / application interface can be installed in the mobile terminal or called by other means, etc. For example, the application in the smart TV is a screen projection application, and the corresponding screen projection application is also needed in the mobile terminal. The application in the smart TV matches the corresponding application in the mobile terminal, but does not belong to the same application. Through the corresponding application or application interface of the mobile terminal, a series of operations can be performed on the application in the smart home device.
[0047] Therefore, when the mobile terminal detects that the start operation for the application in the smart home device is started through the corresponding application / application interface, the corresponding start data packet is generated and broadcasted in the local area network. When the mobile terminal detects that the close operation for the application in the smart home device is closed through the corresponding application / application interface, the corresponding close data packet is generated and broadcasted in the local area network.
[0048] That is, if the preset operation is the start operation of starting the application of the smart home device, the corresponding broadcast data packet is the start data packet. If the preset operation is the close operation of closing the application of the smart home device, the corresponding broadcast data packet is the close data packet.
[0049] Among them, the to-be-managed SDK type in the start data packet / close data packet can include information of all SDKs included in the application of the smart home device, such as the number of all SDKs in the application of the smart home device.
[0050] Further, the information of a specific interface or a specific function of the application in the smart home device that is started or closed can be determined through the corresponding application / application interface. Correspondingly, the preset operation includes the start / close operation of starting / closing a specific interface / a specific function of the application of the smart home device. Correspondingly, the to-be-managed SDK type involved in the start / close operation of starting / closing a specific interface / a specific function of the application of the smart home device can be further determined. For example, when a specific interface of the application in the smart home device is started, the corresponding SDK needs to be started, and when other interfaces are started, the corresponding SDK does not need to be started.
[0051] After the mobile terminal broadcasts the generated broadcast data packet, the smart home device receives the broadcast data packet through the protocol agent.
[0052] 103, the broadcast data packet is parsed through the protocol agent to obtain the to-be-managed SDK type and the management type, and the management type corresponds to the preset operation.
[0053] Since the broadcast data packet is generated according to the protocol rule supported by the protocol agent, after receiving the broadcast data packet, the protocol agent can parse the broadcast data packet, specifically, according to the occupied bits to determine the content of each field, and respectively obtain the content of the flag field, that is, the management type, the content of the SDK type field, that is, the to-be-managed SDK type, the content in the broadcast address field and the extension field, and the like.
[0054] The management type includes starting the to-be-managed SDK and closing the to-be-managed SDK. The management type corresponding to the preset operation can be understood as follows: if the preset operation is a starting operation of starting the application of the smart home device, the management type includes the starting to-be-managed SDK; if the preset operation is a closing operation of closing the application of the smart home device, the management type includes the closing to-be-managed SDK.
[0055] 104, determining the target to-be-managed SDK according to the to-be-managed SDK type, the target to-be-managed SDK belongs to the SDK of the application.
[0056] According to the content of the to-be-managed SDK type field, the target to-be-managed SDK that needs to be managed is determined, and the target to-be-managed SDK belongs to the third-party SDK of the application.
[0057] 105, calling the management interface in the target to-be-managed SDK that matches the management type through the protocol agent, and executing the computer program in the management interface to implement the management of the target to-be-managed SDK, the management including starting and closing.
[0058] After the protocol agent determines the target to-be-managed SDK and the management type, the management interface in the target to-be-managed SDK that matches the management type is called. For example, when the management type is starting the target to-be-managed SDK, the management interface that matches the management type includes a starting interface, and the starting interface can start the target to-be-managed SDK; when the management type is closing the target to-be-managed SDK, the management interface that matches the management type includes a closing interface, and the closing interface can close the target to-be-managed SDK.
[0059] After the corresponding management interface is called, the computer program in the management interface is executed to implement the management of the target to-be-managed SDK. For example, when the management interface is a starting interface, the computer program in the starting interface is executed to implement the starting of the target to-be-managed SDK; when the management interface is a closing interface, the computer program in the closing interface is executed to implement the closing of the target to-be-managed SDK. It should be noted that the closing of the target to-be-managed SDK in the present application includes releasing the content and CPU resources occupied by the target to-be-managed SDK.
[0060] In the embodiment, the protocol agent can be integrated in the smart home device, the broadcast data packet is received and parsed through the protocol agent to start and close the target SDK to be managed, the problem that the target SDK to be managed exists in the memory after the application is started and occupies the memory, CPU and other resources of the smart home device is avoided, and the performance of the smart home device is improved. When the start operation in the smart home device is detected, the target SDK to be managed is started, when the close operation in the smart home device is detected, the target SDK to be managed is closed, the target SDK to be managed is started when used and stopped when not used, more precise management is further implemented, and the performance of the smart home device is further improved.
[0061] Figure 3 A first flowchart of a method for managing an SDK based on a protocol agent is provided in the embodiment, the method is applied to a smart home device, and includes the following steps.
[0062] 201, starting a protocol agent in a smart home device.
[0063] 202, receiving a start data packet broadcast by a mobile terminal in a same local area network through the protocol agent.
[0064] 203, parsing the start data packet through the protocol agent to obtain an SDK type to be managed and a management type, the management type being start.
[0065] 204, determining a target SDK to be managed according to the SDK type to be managed, the target SDK to be managed belonging to an SDK of an application.
[0066] 205, calling a start interface in the target SDK to be managed through the protocol agent and executing a computer program in the start interface to start the target SDK to be managed.
[0067] 206, receiving a close data packet broadcast by a mobile terminal in a same local area network through the protocol agent.
[0068] 207, parsing the close data packet through the protocol agent to obtain an SDK type to be managed and a management type, the management type being close.
[0069] 208, determining a target SDK to be managed according to the SDK type to be managed, the target SDK to be managed belonging to an SDK of an application.
[0070] 209, calling a close interface in the target SDK to be managed through the protocol agent and executing a computer program in the close interface to close the target SDK to be managed.
[0071] It can be understood that in this embodiment, when the target SDK to be managed is started by the starting operation, the target SDK to be managed is closed by the closing operation.
[0072] In an embodiment, the method for managing the SDK based on the protocol agent further includes the following steps.
[0073] 210, detecting, by the protocol agent, whether the non-use time of the target SDK to be managed reaches a preset time.
[0074] The protocol agent further detects the non-use time of the target SDK to be managed. When the non-use time reaches the preset time, it means that the target SDK to be managed has not been used for a period of time (such as the preset time), and then step 211 is performed, otherwise, no processing is performed, and the protocol agent continues to detect the non-use time of the target SDK to be managed. The preset time can be a pre-set time, for example, 10 minutes, 15 minutes, etc.
[0075] 211, calling, by the protocol agent, a closing interface in the target SDK to be managed, and executing a computer program in the closing interface to close the target SDK to be managed.
[0076] In this embodiment, when the target SDK to be managed is started, the protocol agent detects that the target SDK to be managed has not been used for a period of time such as a preset time, and automatically closes the target SDK to be managed, so as to avoid that the target SDK to be managed is in a starting running state for a long time without being used, and occupies the resources of the smart home device, and improves the performance of the smart home device.
[0077] Figure 4 FIG. 4 is another flowchart of the method for managing the SDK based on the protocol agent provided in the embodiments of the present application. The method is applied to a smart home device, and includes the following steps.
[0078] 301, starting the protocol agent in the smart home device.
[0079] 302, receiving, by the protocol agent, a starting data packet broadcast by a mobile terminal in the same local area network.
[0080] 303, parsing, by the protocol agent, the starting data packet to obtain a type of the SDK to be managed and a management type, the management type being starting.
[0081] 304, determining a target SDK to be managed according to the type of the SDK to be managed, the target SDK to be managed belonging to an SDK of an application.
[0082] 305, accessing, by the protocol agent, a cloud server of the smart home device, the cloud server storing pre-configured enabling state information of all SDKs.
[0083] The cloud server of the smart home device stores preconfigured enable state information of all SDKs. When it is detected that there is an unstable SDK or a security risk, the enable state information of the SDK in the cloud server is set to be unable to start; when it is detected that the SDK has no security risk and can be normally used, the enable state information of the SDK in the cloud server is set to be able to start. The enable state information can be represented by 0 and 1, 1 indicating that it can be started, and 0 indicating that it cannot be started; the enable state information can also be represented by other means.
[0084] 306, obtaining target enable state information of the target SDK to be managed.
[0085] After the target SDK to be managed is determined, the cloud server is accessed, and the target enable state information of the target SDK to be managed is obtained from the cloud server.
[0086] 307, when the target enable state information indicates that the target SDK to be managed cannot be started, discarding the start data packet through the protocol agent.
[0087] For example, when the target enable state information is 0, it indicates that the target SDK to be managed cannot be started, and the start data packet is discarded through the protocol agent, and no further processing of the start data packet will be performed.
[0088] In this way, the target enable state information of the target SDK to be managed can be set through the cloud server of the smart terminal device, and the target SDK to be managed is not started when it is unstable or unsafe, thereby improving the stability and security of the smart home device.
[0089] 308, when the target enable state information indicates that the target SDK to be managed can be started, calling the start interface in the target SDK to be managed through the protocol agent, and executing the computer program in the start interface to start the target SDK to be managed.
[0090] For example, when the target enable state information is 1, it indicates that the target SDK to be managed can be started, and the start interface in the target SDK to be managed is called through the protocol agent to start the target SDK to be managed.
[0091] In this case, in addition to receiving the start data packet, the target enable state information indicates that the target SDK to be managed can be started, that is, both conditions are met, and then the target SDK to be managed is started.
[0092] After starting the target SDK to be managed, the target SDK to be managed can also be closed. The method of closing the target SDK to be managed is as described above, and will not be described here.
[0093] For example, Figure 5As shown, the application schematic diagram of the method for managing SDK based on protocol agent provided by the embodiment of the application. The method for managing SDK based on protocol agent is applied to a smart television, the smart television comprising a protocol agent and a screen projection application, for example, a Huawei cast+ screen projection application, and the multi-screen interaction is realized through the screen projection application, wherein the mobile terminal can be a smart phone, for example, a smart phone of Huawei brand. The smart phone broadcasts the generated broadcast data packet, the protocol agent receives the broadcast data packet, and the broadcast data packet is parsed to obtain a management type and a to-be-managed SDK type, the target to-be-managed SDK is determined according to the to-be-managed SDK type, and the screen projection application is managed through the protocol agent. In an embodiment, the cloud server corresponding to the smart television can configure the enable state information of all SDKs in the smart television, the protocol agent obtains the target enable state information of the target to-be-managed SDK, and the target to-be-managed SDK is managed according to the target enable state information.
[0094] In an embodiment, when the start data packet is received through the protocol agent, it is detected whether the corresponding application is started for the first time, if the application is started for the first time, the start data packet is parsed through the protocol agent to obtain a management type and a target to-be-managed SDK type, the target to-be-managed SDK is determined according to the to-be-managed SDK type, the cloud server of the smart home device is accessed through the protocol agent to further obtain the target enable state information of the target to-be-managed SDK, when the target enable state information indicates that the target to-be-managed SDK cannot be started, the start data packet is discarded through the protocol agent, and when the target enable state information indicates that the target to-be-managed SDK can be started, the start interface in the target to-be-managed SDK is called through the protocol agent to realize the start of the target to-be-managed SDK.
[0095] On the basis of all the above embodiments, the method for managing SDK based on protocol agent further comprises initializing the data packet queue in the protocol agent and initializing the thread in the protocol agent after the step of starting the protocol agent in the smart home device. The protocol agent further comprises a data packet queue and a corresponding thread, and the data packet queue and the thread need to be initialized after the protocol agent is started. The data packet queue can be one queue or multiple queues, and is generally one queue. The thread in the protocol agent can be one or multiple, and is generally one thread. Correspondingly, when the protocol agent receives the broadcast data packet broadcasted by the smart home device in the same local area network, the broadcast data packet is saved to the data packet queue, the broadcast data packet is obtained from the data packet queue through the thread of the protocol agent, and the broadcast data packet is parsed. In this way, the asynchronous processing of the broadcast data packet is realized, the broadcast data packet is prevented from being discarded for a long time and thus the start and the shutdown of the target to-be-managed SDK cannot be responded.
[0096] In an embodiment, the method of managing SDK based on a protocol agent further comprises: when the number of broadcast data packets in the data packet queue exceeds a preset number, determining the number of new threads according to the number of broadcast data packets, creating a corresponding number of new threads, and the steps of obtaining broadcast data packets from the data packet queue and parsing the broadcast data packets by the thread of the protocol agent, comprising: obtaining broadcast data packets from the data packet queue and parsing the broadcast data packets by the thread of the protocol agent and the new threads to obtain a to-be-managed SDK type and a management type, determining a target to-be-managed SDK according to the to-be-managed SDK type, and calling a management interface matching the management type in the target to-be-managed SDK by the thread of the protocol agent to manage the target to-be-managed SDK; when the number of broadcast data packets in the data packet queue does not exceed the preset number, recycling the new threads. The preset number can be 50 or the like.
[0097] For example, when the number of broadcast data packets is 120, at this time, the number of broadcast data packets exceeds the preset number 50, then the number of new threads to be created is determined according to the number of broadcast data packets, that is, 2, and two new threads are created, at this time, adding the original one thread, there are three threads, and the broadcast data packets are obtained from the data packet queue by the three threads, and the broadcast data packets are parsed, and the subsequent steps are executed, in this way, the starting and closing of the third-party SDK can be quickly responded, and the performance and response speed of the smart home device are improved.
[0098] According to the method described in the above embodiment, the present embodiment will be further described from the perspective of a device for managing SDK based on a protocol agent. The device for managing SDK based on a protocol agent can be implemented as an independent entity, or can be integrated in a smart home device.
[0099] Please refer to Figure 6 , Figure 6 The device for managing SDK based on a protocol agent provided by the embodiments of the present application is specifically described, which is applied in a smart home device, and the smart home device integrates at least one application, and the application needs to introduce a third-party SDK. The device for managing SDK based on a protocol agent can include an opening module 401, a receiving module 402, a parsing module 403, a determining module 404, and a management module 405.
[0100] The opening module 401 is configured to open a protocol agent in the smart home device.
[0101] The receiving module 402 is configured to receive a broadcast data packet broadcasted by a mobile terminal in a same local area network through the protocol agent, the broadcast data packet is encapsulated according to a protocol rule supported by the protocol agent, and the broadcast data packet is generated by the mobile terminal in response to a preset operation on an application in the smart home device.
[0102] The parsing module 403 is configured to parse the broadcast data packet through the protocol agent to obtain an SDK type to be managed and a management type corresponding to a preset operation.
[0103] The determining module 404 is configured to determine a target SDK to be managed according to the SDK type to be managed, the target SDK to be managed belonging to the SDK of the application.
[0104] The management module 405 is configured to call a management interface matching the management type in the target SDK to be managed through the protocol agent, and execute a computer program in the management interface to implement management of the target SDK to be managed, the management including starting and closing.
[0105] The preset operation is a starting operation of starting the application, the broadcast data packet is a starting data packet, the management type includes starting the target SDK to be managed, and the management interface matching the management type includes a starting interface; correspondingly, the management module 405 is specifically configured to call the starting interface in the target SDK to be managed through the protocol agent, and execute a computer program in the starting interface to implement starting the target SDK to be managed.
[0106] The preset operation is a closing operation of closing the application, the broadcast data packet is a closing data packet, the management type includes closing the target SDK to be managed, and the management interface matching the management type includes a closing interface; correspondingly, the management module 405 is specifically configured to call the closing interface in the target SDK to be managed through the protocol agent, and execute a computer program in the closing interface to implement closing the target SDK to be managed.
[0107] The management module 405 is further configured to, after starting the target SDK to be managed, if it is detected through the protocol agent that the target SDK to be managed has not been used for a preset time, call the closing interface in the target SDK to be managed through the protocol agent, and execute a computer program in the closing interface to implement closing the target SDK to be managed.
[0108] The SDK type to be managed is determined according to the SDK type to be managed. Figure 6As shown, the device based on the protocol agent management SDK can further include an access obtaining module 406. The access obtaining module 406 is configured to access, by the protocol agent, a cloud server of the smart home device, the cloud server storing preconfigured enable state information of all SDKs; and obtain target enable state information of the target SDK to be managed. Correspondingly, the management module 405 is further configured to, when the target enable state information indicates that the target SDK to be managed cannot be started, discard, by the protocol agent, the broadcast data packet; and when the target enable state information indicates that the target SDK to be managed can be started, invoke, by the protocol agent, a management interface in the target SDK to be managed that matches the management type, and execute a computer program in the management interface to implement management on the target SDK to be managed.
[0109] As shown, the device based on the protocol agent management SDK can further include a queue thread management module 407. The queue thread management module 407 is configured to, after starting the protocol agent of the smart home device, Figure 6
[0110] initialize a data packet queue in the protocol agent, and initialize a thread in the protocol agent. The receiving module 402 is further configured to, when receiving a broadcast data packet broadcast by a smart home device in the same local area network, save the broadcast data packet to the data packet queue. Correspondingly, the parsing module 403 is configured to, by the thread of the protocol agent,
[0111] obtain the broadcast data packet from the data packet queue and parse the broadcast data packet.
[0112] As shown, the device based on the protocol agent management SDK can further include a queue thread management module 407. The queue thread management module 407 is configured to, after starting the protocol agent of the smart home device,
[0113] obtain the broadcast data packet from the data packet queue and parse the broadcast data packet. The queue thread management module 407 is further configured to, when the number of broadcast data packets in the data packet queue does not exceed the preset number, recycle the new thread.
[0114] In implementation, each of the above modules can be implemented as an independent entity, or can be combined as the same or several entities. The specific implementation of each of the above modules can be referred to the foregoing method embodiment, and thus will not be described herein.
[0115] The beneficial effects that can be achieved by the above method embodiment are also referred to the beneficial effects of the foregoing method embodiment, and thus will not be described herein.
[0116] In addition, the embodiment of the present application further provides a smart home device, such as Figure 7 As shown in the figure, the smart home device 500 comprises a processor 501 and a memory 502. At least one application program is installed in the smart home device.
[0117] The processor 501 is electrically connected with the memory 502.
[0118] The processor 501 is the control center of the smart home device 500, connects all parts of the smart home device 500 through various interfaces and lines, executes various functions of the smart home device and processes data by running or loading the application programs stored in the memory 502 and calling the data stored in the memory 502, thereby monitoring the smart home device as a whole.
[0119] In the embodiment, the processor 501 in the smart home device 500 loads the instructions corresponding to the processes of one or more application programs into the memory 502, and runs the application programs / computer programs stored in the memory 502 by the processor 501, thereby realizing various functions, such as:
[0120] starting a protocol agent in the smart home device; receiving a broadcast data packet broadcasted by a mobile terminal in the same local area network through the protocol agent, the broadcast data packet being encapsulated according to a protocol rule supported by the protocol agent, the broadcast data packet being generated by the mobile terminal in response to a preset operation on an application in the smart home device; analyzing the broadcast data packet through the protocol agent to obtain a to-be-managed SDK type and a management type, the management type corresponding to the preset operation; determining a target to-be-managed SDK according to the to-be-managed SDK type, the target to-be-managed SDK belonging to an SDK of the application; calling a management interface in the target to-be-managed SDK through the protocol agent, the management interface matching the management type, and executing a computer program in the management interface to realize management of the target to-be-managed SDK, the management including starting and closing.
[0121] The smart home device can realize the steps in any embodiment of the method for managing an SDK based on a protocol agent provided by the embodiment of the present application, and thus can realize the beneficial effects of any method for managing an SDK based on a protocol agent provided by the embodiment of the present application. Details are described in the foregoing embodiments, which will not be described here.
[0122] Figure 8 A specific structure block diagram of the smart home device provided by the embodiment of the present application is shown, which can be used to implement the method for managing an SDK based on a protocol agent provided in the foregoing embodiments. The smart home device comprises the following modules / units.
[0123] RF circuitry 610 enables communication with networks, such as the Internet, intranet and / or a wireless network. The RF circuitry 610 can also include circuitry to facilitate wired communication, such as through a docking station or like terminal. The RF circuitry 610 can alternatively or also include one or more transmitters and / or receivers, configured to transmit and / or receive data wirelessly. The RF circuitry 610 can include circuitry to implement various wireless communication protocols, including but not limited to Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), code division multiple access (CDMA), Time Division Multiple Access (TDMA), Wideband-CDMA (WCDMA), Bluetooth, Wi-Fi, Wi-Max, Voice over Internet Protocol (VoIP), Wi-Fi (IEEE 802.11a, IEEE 802.11b, IEEE 802.11g and / or IEEE 802.11n), wireless fidelity, and / or any other wireless communication protocols. The RF circuitry 610 can further include circuitry to implement a global positioning system (GPS) receiver.
[0124] The memory 620 can be used to store software programs (computer programs) and modules, such as the corresponding program instructions / modules of the above-described embodiments, and the processor 680 can perform various functions and data processing by running the software programs and modules stored in the memory 620. The memory 620 can include a high-speed random access memory, and can further include a non-volatile memory such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 620 can further include a memory disposed remotely from the processor 680, which can be connected to the smart home device 600 through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0125] The input unit 630 can be used to receive input digital or character information, and to generate one or more inputs of a physical keyboard, function keys (such as volume control keys, on / off keys, etc.), trackballs, mice, joysticks, etc. related to user settings and function control.
[0126] The display unit 640 can be used to display information input by a user or information provided to a user and various graphical user interfaces of the smart home device 600, which can be composed of graphics, text, icons, video, and any combination thereof. The display unit 640 can include a display panel 641, which can be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), etc., as an option.
[0127] The smart home device 600 can further include at least one sensor 650, such as a light sensor, a direction sensor, a proximity sensor, and other sensors. As one of the motion sensors, a gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and when at rest, it can detect the magnitude and direction of gravity, which can be used for applications such as recognizing the posture of a mobile phone, vibration recognition related functions (such as a pedometer, tapping), etc. The smart home device 600 can also be configured with a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and other sensors, which will not be described here.
[0128] The audio circuit 660, the speaker 661, and the microphone 662 can provide an audio interface between the user and the smart home device 600. The audio circuit 660 can convert received audio data into an electrical signal, transmit the electrical signal to the speaker 661, and convert the electrical signal into a sound signal output by the speaker 661. On the other hand, the microphone 662 can convert a sound signal collected into an electrical signal, and the audio circuit 660 can convert the electrical signal into audio data, output the audio data to the processor 680 for processing, and transmit the audio data to another smart home device via the RF circuit 610 or output the audio data to the memory 620 for further processing. The audio circuit 660 can further include a jack for a headset, to provide communication between the headset and the smart home device 600.
[0129] The smart home device 600 can help the user to receive a request, transmit information, and the like via the transmission module 670 (e.g., a Wi-Fi module), which provides the user with wireless broadband Internet access. Although the transmission module 670 is illustrated, it can be understood that the transmission module 670 is not necessarily included in the smart home device 600, and can be omitted as needed without changing the nature of the present application.
[0130] The processor 680 is a control center of the smart home device 600, and connects various parts of the smart home device 600 via various interfaces and lines, executes various functions of the smart home device 600 and processes data by running or executing software programs (computer programs) and / or modules stored in the memory 620 and calling data stored in the memory 620, and thus monitors the smart home device as a whole. The processor 680 can include one or more processing cores, and in some embodiments, the processor 680 can include an application processor and a modem processor, in which the application processor mainly processes an operating system, a user interface, and an application, and the modem processor mainly processes wireless communication. It can be understood that the modem processor can not be integrated into the processor 680.
[0131] The smart home device 600 further includes a power supply 690 (e.g., a battery) for supplying power to each component, and in some embodiments, the power supply can be logically connected to the processor 680 via a power management system, so that the power management system can perform functions such as management of charging, discharging, and power consumption management. The power supply 690 can further include one or more direct or alternating current power sources, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
[0132] Although not shown, the smart home device 600 further includes a camera, a Bluetooth module, etc., which are not described herein again. Specifically in the embodiment, the smart home device further includes one or more programs (computer programs), one or more of which are stored in the memory and configured to be executed by one or more processors, and one or more programs contain instructions for performing the following operations:
[0133] starting a protocol agent in the smart home device; receiving, by the protocol agent, a broadcast data packet broadcasted by a mobile terminal in a same local area network, the broadcast data packet being encapsulated according to a protocol rule supported by the protocol agent, the broadcast data packet being generated by the mobile terminal in response to a preset operation on an application in the smart home device; parsing, by the protocol agent, the broadcast data packet to obtain a to-be-managed SDK type and a management type, the management type corresponding to the preset operation; determining a target to-be-managed SDK according to the to-be-managed SDK type, the target to-be-managed SDK belonging to an SDK of the application; calling, by the protocol agent, a management interface in the target to-be-managed SDK that matches the management type, and executing a computer program in the management interface to implement management of the target to-be-managed SDK, the management including starting and stopping.
[0134] Specifically in implementation, each of the above modules can be implemented as an independent entity, or can be combined as the same or several entities, and the specific implementation of each of the above modules can be referred to the method embodiments described above, which are not described herein again.
[0135] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions (computer programs) or by instructions controlling related hardware, and the instructions can be stored in a computer readable storage medium and loaded and executed by a processor. Therefore, the embodiment of the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps of any embodiment of the method for managing an SDK based on a protocol agent provided by the embodiment of the present application.
[0136] The storage medium can include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0137] Since the instructions stored in the storage medium can execute the steps in any embodiment of the method for managing SDK based on protocol agent provided by the embodiments of the application, the beneficial effects that can be achieved in any embodiment of the method for managing SDK based on protocol agent provided by the embodiments of the application can be achieved, which are described in detail in the foregoing embodiments and will not be described here.
[0138] The method, device, storage medium and smart home device based on protocol agent management SDK provided by the embodiments of the application are described in detail above, and the principles and implementation manners of the application are described by applying specific examples. The above embodiment description is only used to help understand the method of the application and its core idea. Meanwhile, for those skilled in the art, the specific implementation manner and application range will be changed according to the idea of the application. In summary, the content of the specification should not be understood as a limitation of the application.
Claims
1. A method based on a protocol proxy management SDK, applied to smart home devices, characterized in that, include: Enable the protocol proxy in the smart home device; The protocol proxy receives broadcast data packets broadcast by mobile terminals within the same local area network. The broadcast data packets are encapsulated according to the protocol rules supported by the protocol proxy. The broadcast data packets are generated by the mobile terminal in response to a preset operation of an application in the smart home device. The broadcast data packets are parsed by the protocol proxy to obtain the SDK type to be managed and the management type, and the management type corresponds to a preset operation; The target SDK to be managed is determined based on the type of SDK to be managed, and the target SDK to be managed belongs to the SDK of the application; When the management type is to start the target SDK to be managed, the cloud server of the smart home device is accessed through the protocol proxy. The cloud server stores the activation status information of all pre-configured SDKs; the target activation status information of the target SDK to be managed is obtained. When the target's enabled status information indicates that the target's managed SDK cannot be started, the broadcast data packet is discarded through the protocol proxy. When the target enabled status information indicates that the target SDK to be managed can be started, the management interface in the target SDK to be managed that matches the management type is called through the protocol proxy, and the computer program in the management interface is executed to realize the management of the target SDK to be managed, the management including starting and stopping.
2. The method according to claim 1, characterized in that, The preset operation is to start the application; the broadcast data packet is a startup data packet; the management type includes starting the target SDK to be managed; and the management interface matching the management type includes a startup interface. The step of executing the computer program in the management interface to manage the target SDK includes: executing the computer program in the startup interface to start the target SDK; or, The preset operation is to close the application, the broadcast data packet is a close data packet, the management type includes closing the target SDK to be managed, and the management interface matching the management type includes a close interface; The step of executing the computer program in the management interface to manage the target SDK to be managed includes: executing the computer program in the shutdown interface to shut down the target SDK to be managed.
3. The method according to claim 2, characterized in that, After executing the computer program in the startup interface to launch the target SDK to be managed, the method further includes: If the protocol proxy detects that the unused time of the target SDK to be managed has reached a preset time, the protocol proxy calls the shutdown interface in the target SDK to be managed and executes the computer program in the shutdown interface to shut down the target SDK to be managed.
4. The method according to claim 1, characterized in that, Also includes: When the broadcast data packet is received through the protocol proxy, it is detected whether the application is being launched for the first time; If this is the first time the system is started, the step of parsing the broadcast data packet through the protocol proxy will be performed.
5. The method according to claim 1, characterized in that, After the step of enabling the protocol proxy in the smart home device, the method further includes: Initialize the packet queue in the protocol proxy, and initialize the threads in the protocol proxy; When a broadcast data packet is received from a smart home device within the same local area network, the broadcast data packet is saved to the data packet queue. The step of parsing the broadcast data packet through the protocol proxy includes: obtaining the broadcast data packet from the data packet queue through the thread of the protocol proxy, and parsing the broadcast data packet.
6. The method according to claim 5, characterized in that, Also includes: When the number of broadcast packets in the packet queue exceeds a preset number, the number of new threads is determined based on the number of broadcast packets. Create the corresponding number of new threads; The step of retrieving broadcast data packets from the data packet queue and parsing the broadcast data packets through the thread proxied by the protocol includes: retrieving broadcast data packets from the data packet queue and parsing the broadcast data packets through the thread proxied by the protocol and a new thread; When the number of broadcast packets in the packet queue does not exceed a preset number, the new thread is recycled.
7. A device based on a protocol proxy management SDK, applied in smart home devices, characterized in that, include: The enabling module is used to enable the protocol proxy in the smart home device; The receiving module is used to receive broadcast data packets broadcast by mobile terminals within the same local area network through the protocol proxy. The broadcast data packets are encapsulated according to the protocol rules supported by the protocol proxy. The broadcast data packets are generated by the mobile terminal in response to a preset operation for an application in the smart home device. The parsing module is used to parse the broadcast data packets through the protocol proxy to obtain the SDK type to be managed and the management type, wherein the management type corresponds to a preset operation; The determination module is used to determine the target SDK to be managed based on the type of SDK to be managed, wherein the target SDK to be managed belongs to the SDK of the application; The access acquisition module is used to access the cloud server of the smart home device through the protocol proxy when the management type is to start the target SDK to be managed. The cloud server stores the activation status information of all pre-configured SDKs; and to acquire the target activation status information of the target SDK to be managed. The management module is used to discard the broadcast data packet through the protocol proxy when the target's enabled status information indicates that the target's managed SDK cannot be started. When the target enabled status information indicates that the target SDK to be managed can be started, the management interface in the target SDK to be managed that matches the management type is called through the protocol proxy, and the computer program in the management interface is executed to realize the management of the target SDK to be managed, the management including starting and stopping.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the method based on the protocol proxy management SDK according to any one of claims 1 to 6.
9. A smart home device, characterized in that, The method includes a processor and a memory, the processor being electrically connected to the memory, the memory being used to store instructions and data, and the processor being used to execute the steps of the method based on the protocol proxy management SDK as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for managing third-party applications of intelligent display equipment
CN102799473A