A method and apparatus for managing a list of screen projection devices
Patent Information
- Application Number
- CN202611097391.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]为了解决现有技术中因投屏设备列表动态刷新而导致的候选状态丢失、列表冗余和连接错误等技术问题,本发明提供了一种用于管理投屏设备列表的方法及装置
1.保证候选状态的连续性与准确性。通过预关联、多维度识别、占位替换和候选状态迁移的闭环机制,本发明确保即使用于标识设备的网络信息对象发生更替,通过声波等辅助方式确定的候选状态也不会丢失,而是被准确地迁移到最新的设备信息上,显著提升了列表状态的稳定性和一致性。
Smart Images

Figure CN122985016A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer network technology, and in particular to a method and apparatus for managing a list of screen-projecting devices. Background Technology
[0002] In the current smart device ecosystem, screen mirroring from mobile devices such as smartphones and tablets to large-screen devices like smart TVs and projectors has become a common function. Typically, mobile devices use the Network Service Discovery (NSD) protocol within a local area network (LAN) to scan for and obtain available mirroring devices, displaying them in a device list. However, the LAN environment is dynamic; the NSD protocol periodically broadcasts and refreshes device information, causing the network information of a mirroring device to change. For example, initial discovery may only obtain the host address, with subsequent updates supplementing it with its unique Media Access Control (MAC) address.
[0003] To enhance user experience, some screen mirroring systems have introduced auxiliary recognition technologies, such as using sound wave communication to quickly locate specific screen mirroring devices near the user. Once the mobile terminal identifies a target device via sound waves, it will add a special marker, such as a "candidate" status, to the device list to guide the user to click on it.
[0004] Existing technologies face certain challenges in handling such dynamic updates. Network discovery and auxiliary identification processes are typically relatively independent systems. When the device list is refreshed or rebuilt due to dynamic changes in network information, ensuring that candidate states determined through auxiliary methods, such as acoustic waves, remain synchronized with the dynamically updated device information is a technical problem that needs to be solved. For example, when the underlying information object representing the same device is replaced, the candidate states attached to the old object may be difficult to retain correctly. Summary of the Invention
[0005] To address the technical problems in existing technologies, such as candidate state loss, list redundancy, and connection errors caused by dynamic refreshing of the screen projection device list, this invention provides a method and apparatus for managing a screen projection device list.
[0006] In a first aspect, the present invention provides a method for managing a list of screen-projecting devices, applied to a mobile terminal, comprising: Before merging the network-discovered device information into the device list, a candidate device cache is queried based on the first identifier of the device information to determine whether the device corresponding to the device information is a candidate device; and in response to determining that the device corresponding to the device information is a candidate device, the candidate status is pre-associated with the device information; During the process of merging the device information into the device list, the device information is compared with the first identifier and the second identifier of the device information already stored in the device list to determine whether the two correspond to the same target device. When it is determined that the device information and the stored device information correspond to the same target device, and the second identifiers of the two are different or the stored device information is missing the second identifier, the device information is used to replace the stored device information in the device list. During the replacement operation, the candidate states associated with the stored device information being replaced are migrated to the new device information; The prerequisite for performing the migration operation is that the new device information and the replaced stored device information meet a preset association consistency condition.
[0007] Optionally, replacing the stored device information in the device list with the device information includes: The stored device information is used as placeholder information, and then replaced with the device information.
[0008] Optionally, migrating the candidate state associated with the replaced stored device information to the new device information includes: The candidate state is removed from the replaced stored device information and then associated with the new device information.
[0009] Optionally, the candidate state is an acoustic candidate state generated by using acoustic communication to assist in identifying the target device.
[0010] Optionally, the first identifier includes a host address and / or a casting code; the second identifier includes a media access control address.
[0011] Optionally, the preset association consistency conditions include: the new device information and the replaced stored device information have the same host address and the same projection code; and, in response to not meeting the association consistency conditions, the candidate states associated with the replaced stored device information are cleared.
[0012] Optionally, the method further includes: Once it is determined that the user has turned off the sound wave search function, initiated a screen mirroring connection, or left the screen mirroring page, the candidate device cache and the candidate status of all devices in the device list are cleared.
[0013] Optionally, the method further includes: The device information that has not been updated by the network discovery module within a preset time period is deleted through a timed mechanism.
[0014] Optionally, the device information discovered by the network is obtained through the Network Service Discovery Protocol.
[0015] Secondly, the present invention also provides an apparatus for managing a list of screen-projecting devices, applied to a mobile terminal, comprising: The pre-association module is used to query the candidate device cache based on the first identifier of the device information to determine whether the device corresponding to the device information is a candidate device before merging the network-discovered device information into the device list; and in response to determining that the device corresponding to the device information is a candidate device, to pre-associate the candidate status with the device information. The identification module is used to determine whether the device information corresponds to the same target device by comparing the device information with the first identifier and the second identifier of the device information already stored in the device list during the process of merging the device information into the device list. The replacement module is used to replace the stored device information in the device list with the device information when it is determined that the device information and the stored device information correspond to the same target device, and the second identifier of the two are different or the stored device information is missing the second identifier. The migration module is used to migrate the candidate states associated with the stored device information being replaced to the new device information during the replacement operation. The prerequisite for performing the migration operation is that the new device information and the replaced stored device information meet a preset association consistency condition.
[0016] Compared with the prior art, the technical solution provided by the present invention has the following beneficial effects: 1. Ensuring the continuity and accuracy of candidate states. Through a closed-loop mechanism of pre-association, multi-dimensional identification, placeholder replacement, and candidate state migration, this invention ensures that even if the network information object used to identify the device changes, the candidate states determined by auxiliary methods such as acoustic waves will not be lost, but will be accurately migrated to the latest device information, significantly improving the stability and consistency of the list states.
[0017] 2. Improve user experience and reduce operational confusion. This invention effectively avoids the problem of duplicate device entries in the list due to inconsistent device information updates. The device list seen by the user is clearer and more accurate. In particular, devices marked as candidates are always the latest and most available, thereby reducing the user's cognitive burden and difficulty in making choices.
[0018] 3. Enhanced system robustness and connection reliability. By introducing an association consistency condition as a prerequisite for migration operations, this invention can proactively identify and handle potential information conflicts, preventing candidate states from being incorrectly associated with mismatched devices. This reduces the risk of users connecting to the wrong target after clicking on a candidate device, thereby improving the success rate of screen mirroring connections and the overall reliability of the system. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a method for managing a list of screen-projecting devices, provided by an embodiment of the present invention. Figure 2 This is a schematic diagram of a device for managing a list of screen projection devices, provided as an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention. In the description of the present invention, it should be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0021] In modern screen mirroring applications, mobile terminals typically need to discover and manage a list of available screen mirroring devices within a local area network. However, due to the broadcast nature of network service discovery protocols, device information is dynamically updated. For example, a device's Media Access Control (MAC) address may not be available during initial network discovery, or the device's screen mirroring code may have changed. Furthermore, to optimize user experience, existing solutions generally use out-of-band channels such as acoustic waves to assist in identifying the target device the user is trying to connect to. This leads to the following technical challenges: how to ensure that auxiliary identification information bound to the device (such as acoustic matching results) is not lost when device information in the device list is updated or replaced, while also avoiding duplicate entries and incorrect device associations. Currently, most existing technologies only use the Media Access Control address as a unique device identifier. Once this identifier is missing or changed, it can easily cause chaos in device list management, thereby reducing the user experience.
[0022] To address the shortcomings of existing technologies, this invention proposes a more robust device list management mechanism. By abandoning the identification scheme of a single fixed identifier, this invention adopts a strategy that integrates multiple identifiers for matching devices within the same device, placeholder replacement, and candidate state transitions, ensuring the accuracy of the device list data and the consistency of user operation selections. This mechanism can adaptively handle scenarios such as gradual completion and dynamic changes of device information; even if the underlying data updates and replaces the device entries displayed on the front-end interface, the user's selection intent can still be fully inherited and preserved. For example, the target device selected through sound wave matching will not lose its association.
[0023] To facilitate understanding, the core terms involved in this invention will first be explained. Device information refers to a data structure discovered through a network that describes a potential screen-casting device, containing at least one or more identifiers for identifying the device. A candidate state is a marker attached to device information, indicating that the device is a potential screen-casting target identified through some auxiliary method, such as acoustic communication, suggesting a high user preference for it. A first identifier is information used for preliminary or non-unique identification of the target device, such as the device's host address (e.g., Internet Protocol (IP) address) and / or screen-casting code; this type of information is readily available but may change. A second identifier is identification information used for more stable or unique identification of the device hardware, such as a media access control address; this type of information is usually fixed. Pre-association refers to the process of pre-querying and attaching candidate states based on the first identifier before formally merging newly discovered device information into the device list, enabling the candidate states to be bound to the latest device information immediately. Migration specifically refers to the operation of transferring the candidate states associated with the old information to the new information when replacing old device information in the list with new device information, thereby achieving candidate state inheritance. Placeholder information typically refers to incomplete, stored device information awaiting updating, such as device information missing the second identifier. Association consistency conditions are a security check performed before migration operations, used to verify whether key attributes between the old and new device information meet preset rules to prevent incorrect state migration.
[0024] The technical solution of this invention will be described in detail below. This invention provides a method for managing a list of screen-projecting devices, applicable to mobile terminals such as smartphones and tablets. The core process of this method aims to solve the problem of maintaining the correct association of candidate states when network discovery information changes dynamically. Figure 1 This is a flowchart illustrating a method for managing a list of screen-casting devices according to an embodiment of the present invention. Figure 1 As shown, the methods for managing the list of screen-casting devices include: S110. Before merging the network-discovered device information into the device list, based on the first identifier of the device information, query the candidate device cache to determine whether the device corresponding to the device information is a candidate device; and in response to determining that the device corresponding to the device information is a candidate device, pre-associate the candidate status with the device information.
[0025] Before merging device information obtained through network discovery, such as via a network service discovery protocol, into the device list, the system performs a pre-association operation. For example, the system extracts the first identifier of the device information, such as its host address or projection code, and then uses this first identifier to query a pre-established candidate device cache. This candidate device cache stores candidate device information identified through auxiliary means such as acoustic waves. If the query matches, indicating that the device information corresponds to a candidate device, the system pre-associates a candidate state representing "candidate" with the device information. This pre-association design ensures that even if the subsequent list merging operation is very complex, the candidate state is already bound to the latest device data, greatly reducing the risk of information loss.
[0026] S120. In the process of merging device information into the device list, the device information is compared with the first identifier and the second identifier of the device information already stored in the device list to determine whether the two correspond to the same target device.
[0027] During the process of merging device information carrying pre-associated information into the device list, an identification step is performed. This new device information is compared with each device entry already stored in the device list to determine if they point to the same physical target device. This comparison is multi-dimensional, comparing not only the second identifier used for unique hardware identification but also the first identifier used for initial identification. This multi-identifier joint judgment mechanism can more accurately identify devices that are "logically identical but have different data representations," such as a device being discovered twice, with its media access control address only included in the second broadcast.
[0028] S130. When it is determined that the device information and the stored device information correspond to the same target device, and the second identifiers of the two are different or the stored device information is missing a second identifier, the device information is used to replace the stored device information in the device list.
[0029] If, in identification step S120, it is determined that the new device information corresponds to the same target device as a previously stored device information entry, and a specific condition is met, a replacement operation will be triggered. The specific condition is that the second identifiers of the two entries are different, or the previously stored device information entry itself is missing a second identifier. For example, the device list may already contain a placeholder device information entry containing only the host address, while the new device information includes both the host address and the corresponding media access control address. In this case, the system will determine that the new device information is a more complete and accurate representation, and therefore will use this new device information to replace the previously stored device information entry in the list. Through this placeholder replacement mechanism, dynamic optimization and information completion of the device list are achieved.
[0030] S140. During the replacement operation, the candidate state associated with the stored device information being replaced is migrated to the new device information.
[0031] During the replacement operation, to ensure continuity of the user experience, the states associated with the old device information being replaced, especially the candidate states, must be processed. Therefore, the candidate states associated with the previously stored device information need to be smoothly migrated to the new device information. Even if the underlying object instance of the device entry seen on the user interface changes, the "candidate" marker representing the user's selection intent will remain in the correct position. This avoids the problem of candidate markers suddenly disappearing due to list refresh, ensuring a consistent user experience.
[0032] The prerequisite for performing the migration operation is that the new device information and the replaced stored device information meet the preset association consistency conditions.
[0033] To ensure the security of the migration operation and prevent the erroneous migration of candidate states to unrelated devices, a crucial prerequisite for performing the migration operation is that the new device information and the replaced stored device information must meet a preset association consistency condition. For example, this condition can be set as follows: the host addresses of the old and new device information must be the same, and the casting codes must also be the same. If, during the comparison, it is found that the second identifiers are different, and the casting codes in the first identifier also conflict, the system will determine that this may be a risky update. In cases where the association consistency condition is not met, the system will not perform the migration operation. As a security strategy, the system will proactively clear the candidate states associated with the replaced stored device information. Although this operation removes candidate markers, it also effectively prevents potential erroneous connection risks caused by device service information (such as casting codes) refreshes. For example, a user selects session 1 of device A corresponding to casting code A via sound waves, but at this time, device A's service refreshes, generating session 2 corresponding to casting code B. If the candidate states are not cleared, the user may mistakenly connect to session 1 when clicking. The mechanism of this invention forces the user to reconfirm by clearing the states, thereby improving the accuracy and security of the connection.
[0034] In some embodiments, stored device information in the list is replaced with device information. Specifically, the stored device information can be treated as a placeholder and replaced with device information containing more complete or up-to-date information. A typical characteristic of this placeholder information is that the second identifier is empty or invalid. By replacing the placeholder information with complete information, the quality of the device list data is gradually improved.
[0035] In some embodiments, migrating a candidate state associated with the stored device information to be replaced to the new device information can be performed in two steps: first, decoupling the candidate state from the existing device information to be replaced; second, associating the candidate state with the new device information used for replacement. This process enables seamless transfer of candidate states between different device data objects.
[0036] In some specific application scenarios, candidate states are typically generated through acoustic communication to assist in identifying target devices. The mobile terminal collects acoustic signals emitted by the projection device via its microphone, decodes the signals to extract device identification information, and marks the corresponding device as a candidate device. This invention can reliably preserve this type of contextual information acquired via out-of-band channels, preventing its loss in complex network environments.
[0037] In some embodiments, to improve the operability of the solution, the first identifier may be at least one of the device host address, Internet Protocol address, and screen mirroring code; the second identifier may be the device media access control address. These two types of identifiers are commonly used identification combinations in existing screen mirroring scenarios. This invention is well compatible with existing device list management logic based on these identifiers and optimizes and improves upon it.
[0038] In some embodiments, to ensure the cleanliness and real-time nature of the device list, the method of the present invention further includes a robust lifecycle management mechanism. On one hand, the system will perform cleanup in response to specific user behaviors or system events. For example, when a user actively disables the sound wave search function, initiates a specific screen mirroring connection, or leaves the screen mirroring function page, the system can perform a global cleanup, clearing the candidate device cache and the candidate states of all devices in the device list. This ensures that each time a user enters the screen mirroring scenario, they are faced with a clean initial state, avoiding interference from old states.
[0039] In some embodiments, a timed mechanism is used to delete device information that has not been updated by the network discovery module within a preset time period. A background timer can periodically check each item in the device list. If a device's information is not discovered or updated by the network discovery module within a preset time period (e.g., 5 minutes), the system determines that the device may be offline or unreachable and removes it from the list. This timeout-based expiration cleanup mechanism effectively prevents offline devices from occupying list space for extended periods, maintaining the validity and accuracy of the device list.
[0040] To clearly illustrate the technical solution of this invention, a detailed description is provided below using a general embodiment that does not limit the specific identifier type. Assuming a mobile terminal with a screen mirroring application maintains a device list, the overall processing flow is as follows: First, the screen mirroring application receives new device information D_new through the network discovery module. Before merging D_new into the device list, the system extracts the first identifier A from D_new and searches the candidate device cache; if a record matching identifier A exists in the cache, D_new is bound to a candidate state. Subsequently, the system traverses the device list, comparing D_new with each stored device information D_old in the list. If it is determined that D_new and a certain D_old have the same first identifier A, but the second identifier B_new carried by D_new is inconsistent with the second identifier B_old of D_old, or the second identifier field of D_old is empty, the system identifies D_new as updated data for D_old and performs the operation of replacing D_old with D_new. Before the formal replacement, the system verifies the consistency conditions, such as checking whether the other key attributes of D_new and D_old match. If the verification passes and D_old is bound to a candidate state, the state transition process is executed, transferring the candidate state from D_old to D_new. After the replacement is complete, only the updated D_new is retained in the device list, and D_new inherits the original candidate state. Through the above processing, even if the underlying device data is updated, the candidate state bound to the user's selection intention can still be completely retained, ensuring the consistency of the device list data and the reliability of its use.
[0041] The following describes the implementation logic of each technical dimension of the present invention through multiple progressive specific embodiments.
[0042] Example 1: Scenario where the second identifier is acquired later than the first identifier This embodiment applies to scenarios where the hardware identifier MAC address lags behind the reporting of the first identifier, such as the IP address or casting code. Initially, the user initiates an acoustic search. The mobile terminal identifies the target TV device via the acoustic channel and obtains the device's host address as the first identifier. The system generates a corresponding device information entry in the device list. This entry only records the host address; the media access control address field is empty, representing placeholder information as defined earlier. Simultaneously, because the device was identified using acoustic assistance, the system binds it to an acoustic candidate state. Subsequently, the mobile terminal's network service discovery module broadcasts and scans to obtain complete TV service information. The new data contains the same host address as described above, and also includes a new device MAC address. After the new device information enters the list merging process, the identification module determines that the old and new entries correspond to the same casting device based on the same host address. Because the new information contains a second identifier, and the old placeholder information lacks the second identifier, the entry replacement condition is met, and the replacement module performs the old and new data replacement. During the replacement process, the migration module verifies that the host addresses of the two entries are consistent, meeting the association consistency condition, and then migrates the acoustic candidate state bound to the old placeholder information to the new device entry with complete information. The device entries displayed on the end-user front end are still the target TVs selected by the sound waves, and the device information is complete; the entire process is seamlessly switched, completely avoiding the problems of candidate status loss and duplicate device entries in the list caused by MAC address completion.
[0043] Example 2: Device projection code refresh and change scenario Assume the device list already stores complete device information for a TV, with each entry containing a host address, MAC address, and casting code A, and this entry is bound to a sound wave candidate state. Due to factors such as manual operation on the TV or service session timeout, the device service information is refreshed, generating a new casting code B. The system captures this change and generates new device information. The host address and MAC address of the new data remain consistent with the old entry, only the casting code is updated to B. After the new device information enters the merging process, the recognition module confirms that the old and new entries point to the same hardware device through a dual comparison of the host address and MAC address. Before performing state migration, the system verifies the association consistency condition. In this scenario, the consistency rule requires that both the host address and the casting code must match; if the current host address is consistent but the casting code has changed, the verification fails, and the system terminates the state migration process. As an alternative processing logic, the system first clears the sound wave candidate state bound to the old entry, and then completes the replacement of the old and new device information. After the replacement is completed, although the device list still displays the TV, the original sound wave candidate marker becomes invalid. This mechanism provides the system with critical security verification logic, preventing the terminal from initiating a connection request to the device using the new credential screen projection code B based on the acoustic wave matching record corresponding to the invalid screen projection code A, effectively preventing anomalies such as connection failure and session matching errors.
[0044] Example 3: Active + Passive Dual Cleanup Mechanism for Device List To maintain a clean and efficient device list, this invention includes a complete list cleanup logic. Firstly, there is proactive cleanup: when a user completes the screen mirroring interaction and clicks the back button to exit the device selection page, the system triggers a cleanup event. This event iterates through all device entries, clears all candidate states bound to device information, and clears the cache of candidate devices used for pre-association matching; ensuring that when the user re-enters the device selection page, there are no historical residual states interfering, and each load is a completely new device retrieval environment. Secondly, there is timed passive cleanup: a background timer continuously runs, waking up at fixed intervals (e.g., every minute) to execute verification logic and read the last discovery timestamp corresponding to each device information. If the difference between the current time and the device's last discovery time exceeds a preset threshold (e.g., 5 minutes), the device is determined to be offline and has exited the local area network; the system removes the device information from the list. Through this combination of proactive cleanup and timed expiration cleanup, the device list can accurately reflect the online available screen mirroring devices within the local area network in real time, improving the overall robustness of the solution and the user experience.
[0045] The present invention also provides an apparatus for managing a list of screen-casting devices, applied to a mobile terminal. For example, the system includes at least one mobile terminal and one or more screen-casting devices, with the mobile terminal running an apparatus for managing the list of screen-casting devices. Figure 2 This is a schematic diagram of a device for managing a list of screen-projecting devices according to an embodiment of the present invention. (Refer to...) Figure 2 The device includes: a pre-association module 21, an identification module 22, a replacement module 23, and a migration module 24.
[0046] The pre-association module 21 is used to query the candidate device cache based on the first identifier of the device information to determine whether the device corresponding to the device information is a candidate device before merging the network-discovered device information into the device list; and in response to determining that the device corresponding to the device information is a candidate device, pre-associating the candidate state with the device information. The identification module 22 is used to determine whether the device information corresponds to the same target device by comparing the first identifier and the second identifier of the device information with the device information already stored in the device list during the process of merging the device information into the device list. The replacement module 23 is used to replace the device information already stored in the device list with the device information when it is determined that the device information and the stored device information correspond to the same target device, and their second identifiers are different or the stored device information is missing the second identifier. The migration module 24 is used to migrate the candidate state associated with the replaced stored device information to the new device information during the replacement operation. The prerequisite for the migration operation is that the new device information and the replaced stored device information meet a preset association consistency condition.
[0047] For example, when a user launches a screen mirroring application and enables the sound wave search function on a mobile terminal, the complete processing flow is as follows: First, TV A near the user sends out a sound wave signal and simultaneously broadcasts its service data within the local area network via the Network Service Discovery Protocol (NSP). The initial broadcast only carries the host address. The mobile terminal collects the sound wave signal through its microphone and decodes it, storing the host address corresponding to TV A in the candidate device cache. Second, the NSP module synchronously captures the broadcast data from TV A containing only the host address, generates corresponding device information, and sends it to the pre-association module. The pre-association module extracts the host address of this device information, retrieves it from the candidate device cache, and if a match is found, binds the device information to a sound wave candidate status and writes it into the device list. At this point, the device list generates a placeholder entry containing only the host address and a candidate marker. Third, TV A initiates a second NSP broadcast. This broadcast data includes both the complete host address and the Media Access Control (Media Access Control) address. This new device information passes through the pre-association module and the identification module in sequence. The identification module compares it with the placeholder information already stored in the list; if the host addresses match, they are determined to be the same target device. Because the new device information has a second identifier while the original placeholder information lacks a second identifier, the replacement module prepares to perform an entry replacement operation. The migration module verifies the consistency conditions: the host addresses of both are the same and the casting code has not changed. The verification passes, and the acoustic candidate status is then migrated from the placeholder information to the new device entry with complete information. After the device list is refreshed, the front end still displays TV A with the candidate mark to the user, and the underlying device data has been updated synchronously. In the fourth step, the user performs an operation on TV A, triggering the device casting code refresh. TV A rebroadcasts service information carrying the new casting code. When this new device information flows to the identification module, the module can still identify its corresponding TV A based on the MAC address; however, when the migration module performs the consistency verification, it detects that the casting codes of the old and new entries are inconsistent, determines that there is an attribute conflict, terminates the candidate status migration process, and clears the original acoustic candidate status. After the list is refreshed, the candidate mark corresponding to TV A disappears, prompting the user to re-execute the acoustic matching process. Finally, when the user exits the screen mirroring device selection page, the system triggers the cleanup logic. The expired cleanup module starts, clearing the candidate statuses bound to all device entries and emptying the candidate device cache. If TV A is directly powered off and goes offline, the expired cleanup module's scheduled task will also remove the device entry from the list when the offline time exceeds the preset 5-minute threshold.
[0048] The device list management method and apparatus provided by this invention can accurately and stably maintain the screen projection device list in a dynamically changing local area network environment. This solution can completely retain user selection intention information generated by out-of-band auxiliary channels such as acoustic waves, effectively overcoming the defects of existing technologies such as list item disorder, candidate status loss, and device misconnection caused by asynchronous device information, and greatly improving the operational stability of screen projection applications and user experience.
[0049] Those skilled in the art will understand that all or part of the steps in the embodiments of the present invention can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, which stores the program or instructions. When the computer program is executed, it performs the steps included in the above-described method embodiments. The aforementioned storage medium can include various media capable of storing program code, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. Therefore, the present invention also provides a computer-readable storage medium storing a computer program thereon. When the program is executed by a processor, it implements the method for managing a list of screen-projecting devices as described in any of the foregoing method embodiments.
[0050] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for managing a list of screen-casting devices, applied to a mobile terminal, characterized in that, include: Before merging the network-discovered device information into the device list, the candidate device cache is queried based on the first identifier of the device information to determine whether the device corresponding to the device information is a candidate device. In response to determining that the device corresponding to the device information is a candidate device, the candidate status is pre-associated with the device information; During the process of merging the device information into the device list, the device information is compared with the first identifier and the second identifier of the device information already stored in the device list to determine whether the two correspond to the same target device. When it is determined that the device information and the stored device information correspond to the same target device, and the second identifiers of the two are different or the stored device information is missing the second identifier, the device information is used to replace the stored device information in the device list. During the replacement operation, the candidate states associated with the stored device information being replaced are migrated to the new device information; The prerequisite for performing the migration operation is that the new device information and the replaced stored device information meet a preset association consistency condition.
2. The method according to claim 1, characterized in that, The step of replacing the stored device information in the device list with the device information includes: The stored device information is used as placeholder information, and then replaced with the device information.
3. The method according to claim 1, characterized in that, The process of migrating the candidate state associated with the replaced stored device information to the new device information includes: The candidate state is removed from the replaced stored device information and then associated with the new device information.
4. The method according to claim 1, characterized in that, The candidate state is an acoustic candidate state generated by using acoustic communication to assist in the identification of the target device.
5. The method according to claim 1, characterized in that, The first identifier includes the host address and / or the casting code; the second identifier includes the media access control address.
6. The method according to claim 5, characterized in that, The preset association consistency conditions include: the new device information has the same host address and the same projection code as the replaced stored device information; and, in response to not meeting the association consistency conditions, the candidate states associated with the replaced stored device information are cleared.
7. The method according to claim 1, characterized in that, The method further includes: Once it is determined that the user has turned off the sound wave search function, initiated a screen mirroring connection, or left the screen mirroring page, the candidate device cache and the candidate status of all devices in the device list are cleared.
8. The method according to claim 1, characterized in that, The method further includes: The device information that has not been updated by the network discovery module within a preset time period is deleted through a timed mechanism.
9. The method according to claim 1, characterized in that, The device information discovered by the network is obtained through the Network Service Discovery Protocol.
10. A device for managing a list of screen-projecting devices, applied to a mobile terminal, characterized in that, include: The pre-association module is used to query the candidate device cache based on the first identifier of the device information to determine whether the device corresponding to the device information is a candidate device before merging the network-discovered device information into the device list; In response to determining that the device corresponding to the device information is a candidate device, the candidate status is pre-associated with the device information; The identification module is used to determine whether the device information corresponds to the same target device by comparing the device information with the first identifier and the second identifier of the device information already stored in the device list during the process of merging the device information into the device list. The replacement module is used to replace the stored device information in the device list with the device information when it is determined that the device information and the stored device information correspond to the same target device, and the second identifier of the two are different or the stored device information is missing the second identifier. The migration module is used to migrate the candidate states associated with the stored device information being replaced to the new device information during the replacement operation. The prerequisite for performing the migration operation is that the new device information and the replaced stored device information meet a preset association consistency condition.