CN116192845A - Device processing method, device, electronic device and storage medium - Google Patents

Device processing method, device, electronic device and storage medium Download PDF

Info

Publication number
CN116192845A
CN116192845A CN202211737235.XA CN202211737235A CN116192845A CN 116192845 A CN116192845 A CN 116192845A CN 202211737235 A CN202211737235 A CN 202211737235A CN 116192845 A CN116192845 A CN 116192845A
Authority
CN
China
Prior art keywords
state information
mode
target
equipment
devices
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211737235.XA
Other languages
Chinese (zh)
Inventor
王润涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chint Group R & D Center Shanghai Co ltd
Original Assignee
Chint Group R & D Center Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chint Group R & D Center Shanghai Co ltd filed Critical Chint Group R & D Center Shanghai Co ltd
Priority to CN202211737235.XA priority Critical patent/CN116192845A/en
Publication of CN116192845A publication Critical patent/CN116192845A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • H04L67/1051Group master selection mechanisms
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The embodiment of the application discloses a device processing method, a device, electronic equipment and a storage medium; according to the method and the device, any one of a plurality of devices located in the same working environment can be used as a target device, and the first state information and the second state information are obtained; determining optimal state information from the first state information and the second state information; if the first state information is the optimal state information, setting the working mode of the target equipment as a main mode; and if the first state information is not the optimal state information, setting the working mode of the target equipment as a slave mode. In the embodiment of the application, each device can obtain the same optimal state device, each device can determine the working mode matched with the device from the master-slave mode according to the same optimal state device, and the working mode of the device can be dynamically adjusted, so that the device utilization rate is improved.

Description

Device processing method, device, electronic device and storage medium
Technical Field
The present application relates to the field of distributed systems, and in particular, to a device processing method, an apparatus, an electronic device, and a storage medium.
Background
In recent years, master-Slave (Master-Slave) is one of the more used architectures in the architecture of distributed hardware. The Master (Master) and the Slave (Slave) are deployed on different servers, respectively. When the master node server writes data, the data is synchronized to the slave node server, and the master node server is responsible for writing data and the slave node server is responsible for reading data in general.
However, the current master-slave mode manages a plurality of slave node servers by setting a fixed master node server, that is, the status of the master node server is determined, so that there is one more dedicated master node server, resulting in low utilization.
Disclosure of Invention
The embodiment of the application provides a device processing method, a device, an electronic device and a storage medium, which can dynamically adjust the working mode of the device and improve the utilization rate of the device.
The embodiment of the application provides a device processing method, which is applied to a target device, wherein the target device is any one device of a plurality of devices in the same working environment, and comprises the following steps:
acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment;
Determining optimal state information from the first state information and the second state information;
if the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing strategies for other equipment in a slave mode by the target equipment in the master mode;
and if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy received from other devices in the master mode by the target device in the slave mode.
The embodiment of the application also provides a device processing apparatus, which is applied to a target device, wherein the target device is any one device of a plurality of devices in the same working environment, and the device processing apparatus comprises:
the device comprises an acquisition unit, a control unit and a control unit, wherein the acquisition unit is used for acquiring first state information and second state information, the first state information is information of states of the target device when the target device operates, the second state information is information of states of other devices when the other devices operate, and the other devices are devices except the target device;
a state determining unit configured to determine optimal state information from the first state information and the second state information;
the first mode determining unit is used for setting the working mode of the target device as a master mode if the first state information is the optimal state information, and the target device in the master mode provides strategies for other devices in the slave mode;
And the second mode determining unit is used for setting the working mode of the target device as a slave mode if the first state information is not the optimal state information, and executing the strategy received from other devices in the master mode by the target device in the slave mode.
In some embodiments, if the first state information is the optimal state information, setting the working mode of the target device to the main mode; if the first state information is not the optimal state information, setting the working mode of the target device to the slave mode, and then, further comprising:
acquiring the working mode of the target equipment and the working modes of the other equipment;
when a plurality of candidate devices in a main mode exist, acquiring third state information of each candidate device, wherein the candidate device is a device in the main mode in the target device and the other devices;
determining optimal third state information from the third state information;
and determining the working modes of target candidate devices as the master mode, and determining the working modes of other candidate devices as the slave mode, wherein the target candidate devices are the candidate devices corresponding to the optimal third state information, and the other candidate devices are the candidate devices except the target candidate device.
In some embodiments, determining optimal state information from the first state information and the second state information includes:
acquiring the working modes of target equipment and other equipment;
if the working mode of the target device and the working modes of other devices are slave modes, counting the quantity of state information, wherein the quantity of state information is the sum of the quantity of first state information and the quantity of second state information;
if the number of the state information is not smaller than the preset number, determining optimal state information from the first state information and the second state information;
and if the number of the state information is smaller than the preset number, acquiring the first state information and the second state information again.
In some embodiments, if the number of state information is not less than the preset number, determining optimal state information from the first state information and the second state information includes:
if the number of the state information is not smaller than the preset number, sorting the first state information and the second state information according to a preset strategy to obtain a state priority list;
optimal state information is determined from the state priority list.
In some embodiments, the first state information carries the identity of the target device and the second state information carries the identity of the other device, after the first state information and the second state information are obtained
Acquiring a preset device list, wherein the preset device list comprises the identification of each device;
determining a target identifier from a preset device list according to the identifier of the target device and the identifiers of other devices;
and generating prompt information according to the target identifier so as to prompt the user that the target device does not receive the second state information sent by other devices carrying the target identifier.
In some embodiments, after setting the operation mode of the target device to the master mode if the first state information is the optimal state information, the method further includes:
in response to a target device failure, the operating mode of the target device is switched from a master mode to a slave mode.
In some embodiments, after setting the operation mode of the target device to the slave mode if the first state information is not the optimal state information, the method further includes:
acquiring a policy receiving time length, wherein the policy receiving time length is the time length of receiving a policy from other devices in a master mode by target devices in a slave mode;
and if the policy receiving duration exceeds the preset duration, the working mode of the target equipment and the working modes of other equipment are redetermined.
The embodiment of the application also provides electronic equipment, which comprises a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to perform steps in any of the device processing methods provided in the embodiments of the present application.
The present embodiments also provide a computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform steps in any of the device processing methods provided in the embodiments of the present application.
The embodiment of the application can be applied to target equipment, wherein the target equipment is any one of a plurality of equipment positioned in the same working environment, and the method comprises the following steps: acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment; determining optimal state information from the first state information and the second state information; if the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing strategies for other equipment in a slave mode by the target equipment in the master mode; and if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy received from other devices in the master mode by the target device in the slave mode.
In the application, each device in the same working environment can be used as a target device, so that each device can acquire the first state information of the device and the second state information of other devices except the device, and each device can set a working mode matched with the device according to the determined optimal state information, and the working mode of the device can be dynamically adjusted, so that the device utilization rate is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1a is a schematic view of a scenario of an apparatus processing method provided in an embodiment of the present application;
FIG. 1b is a schematic flow chart of a device processing method according to an embodiment of the present disclosure;
FIG. 1c is a schematic flow chart of the device processing method according to the embodiment of the present application;
fig. 2 is a schematic structural diagram of an apparatus processing device according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The embodiment of the application provides a device processing method, a device processing apparatus, an electronic device and a storage medium.
The device processing apparatus may be integrated in an electronic device, which may be a terminal, a server, or other devices. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer (Personal Computer, PC) or the like; the server may be a single server or a server cluster composed of a plurality of servers.
In some embodiments, the device processing apparatus may also be integrated in a plurality of electronic devices, for example, the device processing apparatus may be integrated in a plurality of servers, and the device processing method of the present application is implemented by the plurality of servers.
In some embodiments, the server may also be implemented in the form of a terminal.
For example, referring to fig. 1a, the electronic device may be applied to a target device, where the target device is any one of a plurality of devices located in the same working environment, and includes: acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment; determining optimal state information from the first state information and the second state information; if the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing strategies for other equipment in a slave mode by the target equipment in the master mode; and if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy received from other devices in the master mode by the target device in the slave mode.
According to the method and the device, each device located in the same working environment can be used as a target device, so that each device can acquire first state information of the device and second state information of other devices except the device, each device can set a working mode matched with the device according to the determined optimal state information, and the working mode of the device can be dynamically adjusted, and therefore the device utilization rate is improved.
The following will describe in detail. The numbers of the following examples are not intended to limit the preferred order of the examples.
In this embodiment, as shown in fig. 1b, a device processing method is provided, where the device processing method is applied to a target device, and the target device is any one device of multiple devices located in the same working environment, and a specific flow of the device processing method may be as follows:
110. and acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment.
The working environment is an environment where a plurality of interrelated devices work together. For example, the working environment can be a local area network, and the local area network can be particularly applied to micro-grid systems and light storage and charging new energy industries. The structure of the working environment may be a star structure, a tree structure, etc.
The device is used to build a work environment. For example, the device may be a server, a physical machine, or the like.
The target device is any one of a plurality of devices located in the same working environment. For example, if there are 4 devices located in the same operating environment, the target device may be any one of the 4 devices.
The first state information is information of a state of the target device at the time of operation. For example, the first state information may include whether a process in the target device is running normally, whether an acquisition channel is running normally, an occupancy rate of a central processing unit (Central Processing Unit, CPU), an occupancy rate of a memory, network protocol address (Internet Protocol Address, IP address) information, and so on.
The second state information is information of states of other devices when the devices are running. For example, the second state information may include whether the process is running normally in other devices, whether the acquisition channel is normal, occupancy of the central processing unit (Central Processing Unit, CPU), occupancy of the memory, network protocol address (Internet Protocol Address, IP address) information, and so on.
The other device is a device other than the target device among the plurality of devices. For example, there are 4 devices located in the same working environment, namely, device 1, device 2, device 3 and device 4, and if the target device is device 1, the other devices include device 2, device 3 and device 4.
In some embodiments, each target device may broadcast the first status information and may obtain the second status information that is transmitted out by the other devices. In some embodiments, the target device may obtain the second status information of all other devices located in the same working environment, may also obtain the second status information of some other devices located in the same working environment, and so on.
In some embodiments, considering that the target device may only receive the second state information sent by a small portion of other devices, which may cause an error in an operation mode of the target device, the first state information carries an identifier of the target device, the second state information carries an identifier of the other devices, and after obtaining the first state information and the second state information, the method further includes:
acquiring a preset device list, wherein the preset device list comprises the identification of each device;
determining a target identifier from a preset device list according to the identifier of the target device and the identifiers of other devices;
and generating prompt information according to the target identifier so as to prompt the user that the target device does not receive the second state information sent by other devices carrying the target identifier.
The preset device list is preset and comprises identifications of all devices in the same working environment. For example, the preset list of devices is loaded within each device in the operating environment, and the identification of the device may be the IP address of the device, the number of the device, and so on.
The identification of the target device is used to designate the target device as being located in the same operating environment.
The identity of the other device is used to designate the other devices that are located in the same operating environment.
The target identity is an identity of the other device that did not send the second status information.
For example, the preset device list includes an identifier a of the device 1, an identifier B of the device 2, an identifier C of the device 3, and an identifier D of the device 4, if the target device is the device 1, the identifier of the target device is a, and the identifier carried by the second state information is B, C, the target identifier D may be obtained, that is, the device 4 corresponding to the identifier D does not send the second state information.
The prompt information is used for prompting the user that the target device does not receive the second state information sent by other devices carrying the target identifier.
For example, the prompt information may be displayed on a display screen of the target device, or a plurality of alarm lamps are provided on the target device, where the alarm lamps correspond to devices in different identical working environments, and when the alarm lamps are on, the target device is instructed not to receive the second state information corresponding to the alarm lamps.
120. The optimal state information is determined from the first state information and the second state information.
The optimal state information is the optimal state information in the first state information and the second state information. For example, the optimal state information may be first state information of the target device, second state information in one other device, and so on.
For example, if the target device is the device 1, the other devices include the device 2, the device 3 and the device 4, and the device 1 may acquire the first state information of itself, and may also acquire the second state information broadcast by the device 2, the second state information broadcast by the device 3 and the second state information broadcast by the device 4, and the device 1 may compare the first state information, the second state information of the device 2, the second state information of the device 3 and the second state information of the device 4, so as to obtain the optimal state information.
In some embodiments, considering that delay exists in receiving state information, errors are easily caused when the target device determines its own working mode, so that the target device is inconvenient to operate normally, determining optimal state information from the first state information and the second state information includes:
acquiring the working modes of target equipment and other equipment;
if the working mode of the target device and the working modes of other devices are slave modes, counting the quantity of state information, wherein the quantity of state information is the sum of the quantity of first state information and the quantity of second state information;
if the number of the state information is not smaller than the preset number, determining optimal state information from the first state information and the second state information;
And if the number of the state information is smaller than the preset number, acquiring the first state information and the second state information again.
Wherein the operational mode of the target device is used to indicate the functionality of the target device in the operating environment. For example, the operation mode of the target device may be a master mode, policies may be provided for other devices in a slave mode, the operation mode of the target device may also be a slave mode, policies read from other devices in the master mode may be enforced.
The operating mode of the other device is used to indicate the function of the other device in the operating environment. For example, the operation mode of the target device may be a master mode, policies may be provided for other devices in a slave mode, the operation mode of the target device may also be a slave mode, policies read from other devices in the master mode may be enforced.
The amount of state information is the sum of the amount of first state information and the amount of second state information.
The preset number is used for measuring the number of the state information acquired by the target device. For example, the preset number may be a proportion of a plurality of devices located in the same working environment, and the proportion may be half, which is not limited to the preset number. If the ratio is half and the number of the plurality of devices in the same working environment is N, the preset number is equal to N2.
In some embodiments, to facilitate screening out an optimal state device from a plurality of devices, determining optimal state information from the first state information and the second state information if the number of state information is not less than a preset number includes:
if the number of the state information is not smaller than the preset number, sorting the first state information and the second state information according to a preset strategy to obtain a state priority list;
optimal state information is determined from the state priority list.
The state priority list is a list obtained by sorting the running state information of the target equipment and the running state information of other equipment according to the priority. For example, the state priority list may have the operating states arranged from large to small, or from small to large.
For example, the preset policy is a preset policy for comparing state information. For example, the preset policy may be whether the process of comparing each of the first state information and the second state information in turn operates normally, whether the acquisition channel is normal, the occupancy rate of the central processing unit (Central Processing Unit, CPU), the occupancy rate of the memory, the network protocol address (Internet Protocol Address, IP address) information, and so on.
For example, whether the process operation of each state information in the first state information and the second state information is normal is compared, then the state information corresponding to the normal acquisition channel is determined from the state information corresponding to the normal process operation, the state information corresponding to the minimum CPU occupancy rate is continuously determined from the state information corresponding to the normal acquisition channel, the state information corresponding to the minimum memory occupancy rate is continuously determined from the state information corresponding to the minimum CPU occupancy rate, and the state information with the maximum IP address is continuously determined from the state information corresponding to the minimum memory occupancy rate, so that a state priority list is obtained.
If the state priority list indicates that the operation states of the target device and the operation states of other devices are arranged from large to small, the first operation state in the state priority list is the optimal state information.
For example, if the state priority list indicates that the operation states of the target device and the operation states of other devices are arranged from small to large, the last operation state in the state priority list is the optimal state information. Thus, the optimal state information obtained through the state priority list is the state information with normal process operation, normal acquisition channel, minimum CPU occupancy rate, minimum memory occupancy rate and maximum IP address.
130. And if the first state information is the optimal state information, setting the working mode of the target device as a master mode, and providing strategies for other devices in a slave mode by the target device in the master mode.
For example, policies are loaded within the system, and when the target device's operating mode is in the master mode, then the target device may run the system, so that the target device in the master mode may provide policies to other devices in the slave mode.
In some embodiments, to avoid interaction with other devices located in the same working environment after the device in the master mode fails, after setting the working mode of the target device to the master mode if the first state information is the optimal state information, the method further includes:
in response to a target device failure, the operating mode of the target device is switched from a master mode to a slave mode.
140. And if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy read from other devices in the master mode by the target device in the slave mode.
For example, policies are loaded within the system and when the other device's operating mode is in the slave mode, the other device may run the system so that the target device in the slave mode may read the policies into the other device in the master mode.
In some embodiments, considering that each device may broadcast its own working mode and receive the working modes sent by other devices at the same time, that is, each device knows the division of the other devices, and when a plurality of devices communicate with each other, there may be a communication delay, etc. where the communication delay may cause a plurality of devices in a master mode to exist between a plurality of devices that may communicate with each other, in order to avoid that a plurality of devices in a master mode exist in a working environment, to reduce the utilization rate of the devices, if the first state information is the optimal state information, the working mode of the target device is set to the master mode; if the first state information is not the optimal state information, setting the working mode of the target device to the slave mode, and then, further comprising:
acquiring the working mode of the target equipment and the working modes of the other equipment;
when a plurality of candidate devices in a main mode exist, acquiring third state information of each candidate device, wherein the candidate device is a device in the main mode in the target device and the other devices;
determining optimal third state information from the third state information;
and determining the working modes of target candidate devices as the master mode, and determining the working modes of other candidate devices as the slave mode, wherein the target candidate devices are the candidate devices corresponding to the optimal third state information, and the other candidate devices are the candidate devices except the target candidate device.
The candidate device is a device in a main mode in the target device and other devices.
The third state information is information of a state of the candidate device at the time of operation.
The optimal third state information is the optimal third state information obtained from all the third state information according to a preset strategy. The preset strategy is the same as the preset strategy used for ordering the states of the first state information and the second state information.
The target candidate device corresponds to the candidate device for which the optimal third state information corresponds.
The other candidate devices are candidate devices other than the target candidate device.
In some embodiments, determining candidate devices from the target device and other devices based on the operating mode of the target device and the operating mode of the other devices includes:
when only one device in the main mode exists in the working modes of the target device and the other devices, candidate devices are not determined from the target device and the other devices;
when there are a plurality of devices in the master mode in the operation mode of the target device and the operation modes of other devices, a candidate device is determined from the target device and the other devices.
In some embodiments, considering that other devices in the master mode may fail, the target device in the slave mode cannot read the policy from the target device, so that the target device cannot operate normally, in order to avoid that the target device suspends service due to the other devices in the master mode, after setting the working mode of the target device to the slave mode if the first state information is not the optimal state information, the method further includes:
Acquiring a policy receiving time length, wherein the policy receiving time length is the time length of receiving a policy from other devices in a master mode by target devices in a slave mode;
and if the policy receiving duration exceeds the preset duration, the working mode of the target equipment and the working modes of other equipment are redetermined.
The policy receiving duration is a duration that the target device in the slave mode receives the policy from other devices in the master mode.
The preset duration is used to define a duration for receiving policies from other devices in the mode.
In some embodiments, after setting the operation mode of the target device to the slave mode if the first state information is not the optimal state information, the method further includes:
determining the operation modes of other devices corresponding to the optimal state information as a main mode;
adding other devices corresponding to the optimal state information into a local list so that the target device receives strategies from the other devices in the main mode;
if the policy receiving duration exceeds the preset duration, the working mode of the target device and the working modes of other devices are redetermined, including:
deleting other devices in the master mode from the local list;
steps 110-140 are re-performed to re-determine the operational mode of the target device and the operational modes of the other devices. In some embodiments, as shown in fig. 1c, the operating mode of the device is set to slave mode in response to a start-up of the device.
For example, as shown in fig. 1c, step 1: n devices are arranged in the system, the initial working mode of each device is set to be a slave mode, the devices are electrified, and the following steps are circularly executed after the system is started. Step 2: after the system is powered up, each device broadcasts its own (target device) operating mode and status information every 1 second (settable) according to the user datagram protocol (User Datagram Protocol, UDP) in connectionless transport protocol. Step 3: each device (target device) acquires the working mode and the second state information of the other devices, and the target device adds the working mode and the first state information of the target device to the local list. And 4, counting whether equipment in a main mode exists in the system. And 5, if the device in the main mode exists and the state information of the device in the main mode is normal, each device sends a strategy reading request to the device in the main mode, and the step 2 starts. And 6, if the equipment in the master mode does not exist, counting the quantity of state information (namely on-line equipment data) by each equipment, if the quantity of state information is not smaller than the preset quantity, determining optimal state information from a state priority list, determining the working mode of the equipment corresponding to the optimal state information as the master mode, determining the working modes of other equipment as slave modes, and determining the other equipment as equipment except the equipment corresponding to the optimal state information. And 7, in the operation process, if the equipment in the master mode fails, switching the equipment in the master mode into the equipment in the slave mode. And 8, if a plurality of devices (candidate devices) in a master mode exist in the system, determining optimal third state information from third state information of the candidate devices, determining the working mode of the candidate device (target candidate device) corresponding to the optimal third state information as the master mode, determining the working modes of other candidate devices as slave modes, and determining the other candidate devices as candidate devices except the target candidate device. And if the strategy which is not transmitted from the device in the main mode in the exceeding preset time period (when the strategy receiving time period exceeds the preset time period), the device in the main mode is selected from the local list, and the steps 1-6 are re-executed.
As can be seen from the foregoing, the embodiments of the present application may be applied to a target device, where the target device is any one device of a plurality of devices located in the same working environment, and includes: acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment; determining optimal state information from the first state information and the second state information; if the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing strategies for other equipment in a slave mode by the target equipment in the master mode; and if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy read from other devices in the master mode by the target device in the slave mode.
Therefore, each device in the same working environment can be used as a target device, so that each device can acquire the first state information of the device and the second state information of other devices except the device, and each device can set a working mode matched with the device according to the determined optimal state information, and the working mode of the device can be dynamically adjusted, so that the device utilization rate is improved.
In order to better implement the method, the embodiment of the application also provides a device processing device, which can be specifically integrated in an electronic device, and the electronic device can be a terminal, a server or the like. The terminal can be a mobile phone, a tablet personal computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
For example, in the present embodiment, a method of the embodiment of the present application will be described in detail by taking a specific integration of an apparatus processing device in a server as an example.
For example, as shown in fig. 2, the device processing apparatus is applied to a target device, which is any one of a plurality of devices located in the same working environment, and may include an acquisition unit 210, a state determination unit 220, a first mode determination unit 230, and a second mode determination unit 240, as follows:
(one), an acquisition unit 210.
The obtaining unit 210 is configured to obtain first state information and second state information, where the first state information is information of a state of the target device when the target device is operating, the second state information is information of a state of other devices when the target device is operating, and the other devices are devices other than the target device among the plurality of devices.
In some embodiments, the first state information carries an identifier of the target device, the second state information carries identifiers of other devices, and after the first state information and the second state information are acquired, the method further includes:
acquiring a preset device list, wherein the preset device list comprises the identification of each device;
determining a target identifier from a preset device list according to the identifier of the target device and the identifiers of other devices;
and generating prompt information according to the target identifier so as to prompt the user that the target device does not receive the second state information sent by other devices carrying the target identifier.
(two), a state determination unit 220.
The state determining unit 220 is configured to determine optimal state information from the first state information and the second state information.
In some embodiments, determining optimal state information from the first state information and the second state information includes:
acquiring the working modes of target equipment and other equipment;
if the working mode of the target device and the working modes of other devices are slave modes, counting the quantity of state information, wherein the quantity of state information is the sum of the quantity of first state information and the quantity of second state information;
if the number of the state information is not smaller than the preset number, determining optimal state information from the first state information and the second state information;
And if the number of the state information is smaller than the preset number, acquiring the first state information and the second state information again.
In some embodiments, if the number of state information is not less than the preset number, determining optimal state information from the first state information and the second state information includes:
if the number of the state information is not smaller than the preset number, sorting the first state information and the second state information according to a preset strategy to obtain a state priority list;
optimal state information is determined from the state priority list.
(III), a first mode determination unit 230.
The first mode determining unit 230 is configured to set the operation mode of the target device to the master mode if the first state information is the optimal state information, and the target device in the master mode provides the policy to other devices in the slave mode.
In some embodiments, after setting the operation mode of the target device to the master mode if the first state information is the optimal state information, the method further includes:
in response to a target device failure, the operating mode of the target device is switched from a master mode to a slave mode.
(IV), a second mode determining unit 240.
The second mode determining unit 240 is configured to set the operation mode of the target device to the slave mode if the first status information is not the optimal status information, and the target device in the slave mode executes the policy read from the other devices in the master mode.
In some embodiments, if the first state information is the optimal state information, setting the working mode of the target device to the main mode; if the first state information is not the optimal state information, setting the working mode of the target device to the slave mode, and then, further comprising:
acquiring the working mode of the target equipment and the working modes of the other equipment;
when a plurality of candidate devices in a main mode exist, acquiring third state information of each candidate device, wherein the candidate device is a device in the main mode in the target device and the other devices;
determining optimal third state information from the third state information;
and determining the working modes of target candidate devices as the master mode, and determining the working modes of other candidate devices as the slave mode, wherein the target candidate devices are the candidate devices corresponding to the optimal third state information, and the other candidate devices are the candidate devices except the target candidate device.
In some embodiments, after setting the operation mode of the target device to the slave mode if the first state information is not the optimal state information, the method further includes:
acquiring a policy receiving time length, wherein the policy receiving time length is the time length for reading a policy from other devices in a master mode by target devices in a slave mode;
And if the policy receiving duration exceeds the preset duration, the working mode of the target equipment and the working modes of other equipment are redetermined.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, the device processing apparatus of the present embodiment is applied to a target device, where the target device is any one of a plurality of devices located in the same working environment, and the acquiring unit acquires first state information and second state information, where the first state information is information of states of the target device when the target device is running, and the second state information is information of states of other devices when the other devices are running, and the other devices are devices other than the target device among the plurality of devices; determining, by the state determining unit, optimal state information from the first state information and the second state information; if the first state information is the optimal state information, the first mode determining unit sets the working mode of the target device as a master mode, and the target device in the master mode provides strategies for other devices in the slave mode; and if the first state information is not the optimal state information, setting the working mode of the target device to a slave mode by the second mode determining unit, and executing the strategy read from other devices in the master mode by the target device in the slave mode.
Therefore, the working mode of the equipment can be dynamically adjusted, and the equipment utilization rate is improved.
Correspondingly, the embodiment of the application also provides electronic equipment which can be a terminal or a server, wherein the terminal can be terminal equipment such as a smart phone, a tablet personal computer, a notebook computer, a touch screen, a game machine, a personal computer, a personal digital assistant (Personal Digital Assistant, PDA) and the like.
As shown in fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 300 includes a processor 310 with one or more processing cores, a memory 320 with one or more computer readable storage media, and a computer program stored on the memory 320 and executable on the processor. The processor 310 is electrically connected to the memory 320. It will be appreciated by those skilled in the art that the electronic device structure shown in the figures is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The processor 310 is a control center of the electronic device 300, connects various parts of the entire electronic device 300 using various interfaces and lines, and performs various functions of the electronic device 300 and processes data by running or loading software programs and/or modules stored in the memory 320, and calling data stored in the memory 320, thereby performing overall monitoring of the electronic device 300.
In the embodiment of the present application, the processor 310 in the electronic device 300 loads the instructions corresponding to the processes of one or more application programs into the memory 320 according to the following steps, and the processor 310 executes the application programs stored in the memory 320, so as to implement various functions:
the device processing method is applied to a target device, wherein the target device is any one of a plurality of devices positioned in the same working environment, and comprises the following steps:
acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment;
determining optimal state information from the first state information and the second state information;
if the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing strategies for other equipment in a slave mode by the target equipment in the master mode;
and if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy read from other devices in the master mode by the target device in the slave mode.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in fig. 3, the electronic device 300 further includes: touch display 330, radio frequency circuit 340, audio circuit 350, input unit 360, and power supply 370. The processor 310 is electrically connected to the touch display 330, the radio frequency circuit 340, the audio circuit 350, the input unit 360, and the power supply 370, respectively. Those skilled in the art will appreciate that the electronic device structure shown in fig. 3 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components.
The touch display 330 may be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 330 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of the electronic device, which may be composed of graphics, text, icons, video, and any combination thereof. Alternatively, the display panel may be configured in the form of a liquid crystal display (LCD, liquid Crystal Display), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations on or near the user (such as operations on or near the touch panel by the user using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 310, and can receive commands from the processor 310 and execute them. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is transferred to the processor 310 to determine a type of touch event, and the processor 310 then provides a corresponding visual output on the display panel based on the type of touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 330 to implement the input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch sensitive display 330 may also implement an input function as part of the input unit 360.
The radio frequency circuit 340 may be configured to receive and transmit radio frequency signals to and from a network device or other electronic device via wireless communication to and from the network device or other electronic device.
Audio circuitry 350 may be used to provide an audio interface between a user and an electronic device through a speaker, microphone. The audio circuit 350 may transmit the received electrical signal after audio data conversion to a speaker, where the electrical signal is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signals into electrical signals, which are received by the audio circuit 350 and converted into audio data, which are processed by the audio data output processor 310 for transmission to, for example, another electronic device via the radio frequency circuit 340, or which are output to the memory 320 for further processing. Audio circuitry 350 may also include an ear bud jack to provide communication of the peripheral headphones with the electronic device.
The input unit 360 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 370 is used to power the various components of the electronic device 300. Alternatively, the power supply 370 may be logically connected to the processor 310 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system. The power supply 370 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown in fig. 3, the electronic device 300 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
As can be seen from the foregoing, each device in the same working environment may be used as a target device by the electronic device provided in this embodiment, so each device may obtain the first state information of the device and the second state information of the other devices except the device, and each device may set a working mode matched with the device according to the determined optimal state information, so the working mode of the device may be dynamically adjusted, thereby improving the device utilization rate.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a plurality of computer programs that can be loaded by a processor to perform steps in any of the device processing methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
the device processing method is applied to a target device, wherein the target device is any one of a plurality of devices positioned in the same working environment, and comprises the following steps:
acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment;
determining optimal state information from the first state information and the second state information;
If the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing strategies for other equipment in a slave mode by the target equipment in the master mode;
and if the first state information is not the optimal state information, setting the working mode of the target device as a slave mode, and executing the strategy read from other devices in the master mode by the target device in the slave mode.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The steps in any of the device processing methods provided in the embodiments of the present application may be executed by the computer program stored in the storage medium, so that the beneficial effects that any of the device processing methods provided in the embodiments of the present application may be achieved, which are detailed in the previous embodiments and are not described herein.
The foregoing describes in detail a device processing method, apparatus, electronic device, and storage medium provided in the embodiments of the present application, and specific examples are applied to illustrate principles and implementations of the present application, where the foregoing examples are only used to help understand the method and core idea of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. The device processing method is applied to a target device, wherein the target device is any one device of a plurality of devices in the same working environment, and the device processing method comprises the following steps:
acquiring first state information and second state information, wherein the first state information is information of states of the target equipment in operation, the second state information is information of states of other equipment in operation, and the other equipment is equipment except the target equipment in the plurality of equipment;
determining optimal state information from the first state information and the second state information;
if the first state information is the optimal state information, setting the working mode of the target equipment as a master mode, and providing a strategy for the other equipment in the slave mode by the target equipment in the master mode;
and if the first state information is not the optimal state information, setting the working mode of the target equipment as a slave mode, and executing the strategy received from the other equipment in the master mode by the target equipment in the slave mode.
2. The apparatus processing method according to claim 1, wherein when the first state information is the optimal state information, an operation mode of the target apparatus is set to a main mode; if the first state information is not the optimal state information, setting the working mode of the target device to a slave mode, and then further including:
Acquiring the working mode of the target equipment and the working modes of the other equipment;
when a plurality of candidate devices in a main mode exist, acquiring third state information of each candidate device, wherein the candidate device is a device in the main mode in the target device and the other devices;
determining optimal third state information from the third state information;
and determining the working modes of target candidate devices as the master mode, and determining the working modes of other candidate devices as the slave mode, wherein the target candidate devices are the candidate devices corresponding to the optimal third state information, and the other candidate devices are the candidate devices except the target candidate device.
3. The device processing method of claim 1, wherein the determining optimal state information from the first state information and the second state information comprises:
acquiring the working mode of the target equipment and the working modes of the other equipment;
if the working mode of the target device and the working mode of the other devices are slave modes, counting the quantity of state information, wherein the quantity of state information is the sum of the quantity of the first state information and the quantity of the second state information;
If the number of the state information is not smaller than the preset number, determining optimal state information from the first state information and the second state information;
and if the number of the state information is smaller than the preset number, re-acquiring the first state information and the second state information.
4. The device processing method of claim 3, wherein determining optimal state information from the first state information and the second state information if the number of state information is not less than a preset number, comprises:
if the number of the state information is not smaller than the preset number, sequencing the first state information and the second state information according to a preset strategy to obtain a state priority list;
and determining optimal state information from the state priority list.
5. The device processing method of claim 1, wherein the first state information carries an identification of the target device, the second state information carries an identification of the other device, and after the acquiring the first state information and the second state information, further comprising:
acquiring a preset equipment list, wherein the preset equipment list comprises an identifier of each piece of equipment;
Determining a target identifier from the preset device list according to the identifier of the target device and the identifiers of the other devices;
and generating prompt information according to the target identifier so as to prompt a user that the target device does not receive the second state information sent by the other devices carrying the target identifier.
6. The device processing method of claim 1, further comprising, after the setting the operation mode of the target device to the master mode if the first state information is the optimal state information:
and responding to the fault of the target equipment, and switching the working mode of the target equipment from the master mode to the slave mode.
7. The device processing method of claim 1, further comprising, after the setting the operation mode of the target device to the slave mode if the first state information is not the optimal state information:
acquiring a policy receiving time length, wherein the policy receiving time length is the time length of the target device in the slave mode to receive a policy from the other devices in the master mode;
and if the policy receiving duration exceeds the preset duration, re-determining the working mode of the target equipment and the working modes of the other equipment.
8. A device processing apparatus, applied to a target device, where the target device is any one of a plurality of devices located in a same working environment, comprising:
an obtaining unit, configured to obtain first state information and second state information, where the first state information is information of a state of the target device during operation, the second state information is information of a state of other devices during operation, and the other devices are devices other than the target device among the multiple devices;
a state determining unit configured to determine optimal state information from the first state information and the second state information;
the first mode determining unit is used for setting the working mode of the target device as a master mode if the first state information is the optimal state information, and the target device in the master mode provides a strategy for the other devices in the slave mode;
and the second mode determining unit is used for setting the working mode of the target equipment as a slave mode if the first state information is not the optimal state information, and the target equipment in the slave mode executes strategies received from the other equipment in the master mode.
9. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps in the device processing method according to any of claims 1-7.
10. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the device processing method of any one of claims 1 to 7.
CN202211737235.XA 2022-12-30 2022-12-30 Device processing method, device, electronic device and storage medium Pending CN116192845A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211737235.XA CN116192845A (en) 2022-12-30 2022-12-30 Device processing method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211737235.XA CN116192845A (en) 2022-12-30 2022-12-30 Device processing method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN116192845A true CN116192845A (en) 2023-05-30

Family

ID=86439577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211737235.XA Pending CN116192845A (en) 2022-12-30 2022-12-30 Device processing method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN116192845A (en)

Similar Documents

Publication Publication Date Title
US20200015163A1 (en) Scanning Method and Device
WO2018214871A1 (en) Radio frequency interference processing method and electronic device
CN112230877A (en) Voice operation method and device, storage medium and electronic equipment
CN114327087A (en) Input event processing method and device, electronic equipment and storage medium
CN107291213B (en) Mode selection method, device, terminal and computer readable storage medium
CN106851595B (en) Ordered broadcast processing method, device and terminal device
CN111404242A (en) Charging method, charging device, storage medium and mobile terminal
CN116192845A (en) Device processing method, device, electronic device and storage medium
CN113395203B (en) Information processing method, device, server, user terminal and storage medium
WO2019024643A1 (en) Data synchronization control method, device and electronic equipment
CN112542867B (en) Mobile terminal power supply control method and device, terminal equipment and storage medium
CN111542037B (en) Instruction transmission method, apparatus and storage medium
CN111262737B (en) Port configuration management method and device, storage medium and terminal
CN112764564B (en) Touch information processing method and device, storage medium and electronic equipment
CN112860352A (en) Application loading method and device, storage medium and terminal
CN112492554A (en) Data transmission method, device, storage medium and terminal
CN112256610B (en) Connection control method, system, storage medium and mobile terminal
CN114189436B (en) Multi-cluster configuration deployment method and device, electronic equipment and storage medium
CN110971760B (en) Network communication content output control method and device, storage medium and terminal equipment
CN117542134B (en) Communication method and device of passive device, electronic device and readable storage medium
CN117412276A (en) Bluetooth connection method, device, medium and equipment
CN115936626A (en) System management method, device, computer equipment and computer readable storage medium
CN117411827A (en) Data transmission method and device, storage medium and computer equipment
CN112199245A (en) Mobile terminal screen detection method, system, storage medium and mobile terminal
CN117407130A (en) Application management and control method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination