Embodiment
Be described below in detail embodiments of the invention, the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or has element that is identical or similar functions from start to finish.Being exemplary below by the embodiment be described with reference to the drawings, only for explaining the present invention, and can not limitation of the present invention being interpreted as.On the contrary, embodiments of the invention comprise fall into attached claims spirit and intension within the scope of all changes, amendment and equivalent.
Fig. 1 is the schematic flow sheet of the method for state management of the wireless communication module that one embodiment of the invention proposes, and this wireless communication module is used for household electrical appliance, and the method for state management of this wireless communication module comprises:
S101: wireless communication module receives event message.
In an embodiment of the present invention, wireless communication module is specially wireless WIFI communication module.
Wherein, wireless WIFI communication module supports Wi-Fi technology, for household electrical appliance.
Household electrical appliance are air conditioner, refrigerator such as, and water heater etc.
Such as, Asymmetrical Digital Subscriber Line (the AsymmetricDigitalSubscriberLine of user's family, ADSL), partial wideband etc., wireless communication module can be connected to realize the wireless Internet access of mobile terminal by using family expenses Wi-Fi technology.Further, user also can be interconnected with corresponding Cloud Server by household electrical appliance by use wireless communication module, to realize the resource-sharing of household electrical appliance and Cloud Server.
Wireless communication module in current household electrical appliance normally uses as receiving terminal, and namely must rely on another network generator (such as, cable network) provides network to connect to household electrical appliance.But, the scope that user may want to utilize wireless communication module to increase network signal to be contained; Or, also may think to make wireless communication module that cable network is transformed into wireless network simultaneously; Or, also may want to make wireless communication module as wireless base station (AP), electronic installation is connected to each other.Wireless communication module in household electrical appliance in correlation technique can only provide wherein a kind of network morphology or function usually.
Alternatively, event message comprises application affairs message and WIFI callback events message, and wireless communication module receives event message, comprising: application affairs message queue receives the application affairs message that service logic thread generates; WIFI event call-back submodule receives WIFI callback events message, and after receiving WIFI callback events message, WIFI callback events message is added into application affairs message queue.
Wherein, application affairs message is adjusted back submodule service control logic thread by the main thread in wireless communication module by application affairs and is generated, and WIFI callback events message is produced by application program.
Particularly, application affairs message can be the event that the upper layer application of wireless communication module initiatively produces, and such as, wireless communication module cancels ap mode, then can produce the application affairs message of AF_EVT_AP_STOP.
WIFI callback events message can be the event of the WIFI bottom feedback of wireless communication module, and such as, the ap mode of wireless communication module is opened successfully, then can produce the WIFI callback events message of AF_EVT_AP_STARTED_SUCCESS.
Alternatively, wireless communication module also comprises before receiving event message: the State Transferring mechanism of configuration wireless communication module.
S102: event message is distributed to corresponding state machine by the mode attribute according to event message, and wherein, mode attribute is AP-Mode, STA-Mode, or any one in System.
Particularly, according to the mode attribute of event message, event message is distributed to corresponding state machine by state machine events distribution processor submodule, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System.
Wireless communication module supports focus (AccessPoint, AP) mode of operation AP-Mode, AP-Mode is applied in adding of WLAN (wireless local area network) member device (i.e. client), i.e. network downstream, there is provided and wirelessly set up WLAN (wireless local area network) WLAN, the central apparatus of suitable WLAN.Wireless communication module also can support performance station Mode S TA-Mode, also can be understood as a work station in certain grid and client.When the WIFI chip of a wireless communication module provides STA-Mode function, wireless communication module just can be linked in the middle of an other network.AP-Mode is supplied to the connections such as mobile terminal, and STA-Mode is for providing the data uplink service of network.In addition, the grid state of wireless communication module place system, namely wireless communication module in systems in which with the network connection state of network user, can be described by system state dependency, the corresponding handover management being undertaken between system mode by System state machine.
Wherein, state machine comprises AP-Mode state machine, STA-Mode state machine, and System state machine, the corresponding STA-Mode state machine of mode attribute AP-Mode corresponding A P-Mode state machine, mode attribute STA-Mode, and the corresponding System state machine of mode attribute System.
S103: the machine-processed state controlling wireless communication module of State Transferring according to event message and corresponding state machine switches.
Wherein, the state of wireless communication module comprise in AP-Mode state machine set up in AP, AP run in and idle three kinds of states, to connect and idle three kinds of states in the connection in STA-Mode state machine; Network in System state machine is not set up, network has been set up and initialization three kinds of states.
Alternatively, the machine-processed state controlling wireless communication module of State Transferring according to event message and corresponding state machine switches, comprise: if the mode attribute of event message is AP-Mode, then the AP-Mode state machine state that controls wireless communication module according to the State Transferring mechanism of event message and AP-Mode state machine setting up in AP, AP run in and switch between idle three kinds of states; If the mode attribute of event message is STA-Mode, then STA-Mode state machine in this connection, has connected according to the machine-processed state controlling wireless communication module of State Transferring of event message and STA-Mode state machine and has switched between idle three kinds of states; If the mode attribute of event message is System, then the state that System state machine controls wireless communication module according to the State Transferring mechanism of event message and System state machine is not set up at network, network has been set up and switched between initialization three kinds of states.
In the present embodiment, by event message being distributed to corresponding state machine according to the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System, and switch according to the machine-processed state controlling wireless communication module of State Transferring of event message and corresponding state machine, the cooperating operation of three kinds of state machines in the wireless communication module of household electrical appliance can be realized, effectively promote the condition managing effect of wireless communication module.
Fig. 2 is the schematic flow sheet of the method for state management of the wireless communication module that another embodiment of the present invention proposes, and the method for state management of this wireless communication module comprises:
S201: the State Transferring mechanism of configuration wireless communication module.
Wireless communication module is specially wireless WIFI communication module.
Wherein, wireless WIFI communication module supports Wi-Fi technology, for household electrical appliance.
Particularly, by state machine events distribution processor submodule by AP-Mode state machine, STA-Mode state machine, and the status attribute superposition of System state machine, to configure the State Transferring mechanism of wireless communication module.
Wherein, the status attribute of state machine is for identifying the state of wireless communication module.
By this step, the plug-in in wireless communication module can be made to call the status attribute configured, wireless communication module can be switched between different states, realize the cooperating operation of three kinds of state machines in wireless communication module.
S202: application affairs message queue receives the application affairs message that service logic thread generates.
Wherein, application affairs message adjusts back the generation of submodule service control logic thread by the main thread in wireless communication module by application affairs.
Particularly, application affairs message can be the event that the upper layer application of wireless communication module initiatively produces, and such as, wireless communication module cancels ap mode, then can produce the application affairs message of AF_EVT_AP_STOP.
S203:WIFI event call-back submodule receives WIFI callback events message, and after receiving WIFI callback events message, WIFI callback events message is added into application affairs message queue.
WIFI callback events message can be the event of the WIFI bottom feedback of wireless communication module, and such as, the ap mode of wireless communication module is opened successfully, then can produce the WIFI callback events message of AF_EVT_AP_STARTED_SUCCESS.
S204: read the application affairs message in application affairs message queue and WIFI callback events message.
Particularly, application affairs message in application affairs message queue and WIFI callback events message is read by the main thread in wireless communication module by state machine events distribution processor submodule.
S205: event message is distributed to corresponding state machine by the mode attribute according to event message, and wherein, mode attribute is AP-Mode, STA-Mode, or any one in System.
Particularly, according to the mode attribute of event message, event message is distributed to corresponding state machine by state machine events distribution processor submodule, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System.
Wireless communication module supports focus (AccessPoint, AP) mode of operation AP-Mode, AP-Mode is applied in adding of WLAN (wireless local area network) member device (i.e. client), i.e. network downstream, there is provided and wirelessly set up WLAN (wireless local area network) WLAN, the central apparatus of suitable WLAN.Wireless communication module also can support performance station Mode S TA-Mode, also can be understood as a work station in certain grid and client.When the WIFI chip of a wireless communication module provides STA-Mode function, wireless communication module just can be linked in the middle of an other network.AP-Mode is supplied to the connections such as mobile terminal, and STA-Mode is for providing the data uplink service of network.In addition, the grid state of wireless communication module place system, namely wireless communication module in systems in which with the network connection state of network user, can be described by system state dependency, the corresponding handover management being undertaken between system mode by System state machine.
Wherein, state machine comprises AP-Mode state machine, STA-Mode state machine, and System state machine, the corresponding STA-Mode state machine of mode attribute AP-Mode corresponding A P-Mode state machine, mode attribute STA-Mode, and the corresponding System state machine of mode attribute System.
Condition managing is carried out respectively by event message being distributed to corresponding state machine, the logicality of code structure can be strengthened in WIFI router bottom hardware realizes, reduce the complexity of code development, be convenient to the Function Extension of later stage wireless communication module hardware system.
S206: the state controlling wireless communication module according to event message and State Transferring mechanism switches.
Particularly, as shown in Figure 3, for radio communication mold bulk state in the embodiment of the present invention switches schematic diagram, wherein, comprise: AP-Mode state machine 31, STA-Mode state machine 32, System state machine 33, state machine events distribution processor submodule 34, application affairs message queue 35, AP-Mode state machine state switching flow 36, STA-Mode state machine state switching flow 37, and System state machine state switching flow 38.
Can switch according to the machine-processed state controlling wireless communication module of State Transferring of the content of event message and corresponding state machine.
Such as, as shown in Figure 3, wireless communication module cancels ap mode, then can produce AF_EVT_AP_STOP application affairs message, the content of this AF_EVT_AP_STOP application affairs message is for cancelling ap mode, when wireless communication module is in the operating state of AP, and when the main thread of wireless communication module reads this AF_EVT_AP_STOP application affairs message, AP-Mode state machine controls wireless communication module and switches to idle state by the operating state of AP.
In the present embodiment, by configuring the State Transferring mechanism of wireless communication module, the plug-in in wireless communication module can be made to call the status attribute configured, wireless communication module can be switched between different states, by event message being distributed to corresponding state machine according to the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System, and switch according to the machine-processed state controlling wireless communication module of State Transferring of event message and corresponding state machine, the cooperating operation of three kinds of state machines in the wireless communication module of household electrical appliance can be realized, the condition managing effect of effective lifting wireless communication module.Condition managing is carried out respectively by event message being distributed to corresponding state machine, the logicality of code structure can be strengthened in WIFI router bottom hardware realizes, reduce the complexity of code development, be convenient to the Function Extension of later stage wireless communication module hardware system.
Fig. 4 is the structural representation of the wireless communication module 40 that another embodiment of the present invention proposes, and this wireless communication module is used for household electrical appliance, and this wireless communication module 40 comprises serial data receiving or sending thread 41, for communicating with household electrical appliance; Network data receiving or sending thread 42, for communicating with Cloud Server; Service logic thread 43, for carrying out message with serial data receiving or sending thread 41, network data receiving or sending thread 42, controls with the message of receiving and dispatching serial data receiving or sending thread 41 and network data receiving or sending thread 42; Main thread 44, main thread 44 is for controlling serial data receiving or sending thread 41, network data receiving or sending thread 42 and service logic thread 43; Application affairs readjustment submodule 45, main thread 44 is by application affairs readjustment submodule 45 service control logic thread 43; And application affairs message queue 46, for receiving event message, and read for main thread 44, wherein, event message comprises application affairs message and WIFI callback events message; State machine events distribution processor submodule 47, for event message being distributed to corresponding state machine 48 according to the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System, read the application affairs message in application affairs message queue 46 and WIFI callback events message, the State Transferring mechanism of configuration wireless communication module 40; State machine 48, switches for the state controlling wireless communication module 40 according to event message and State Transferring mechanism.
In one embodiment of the invention, this wireless communication module 40 comprises serial data receiving or sending thread 41, for communicating with household electrical appliance.
Wireless communication module is specially wireless WIFI communication module.
Wherein, wireless WIFI communication module supports Wi-Fi technology, for household electrical appliance.
Serial ports and serial line interface are the expansion interfaces adopting serial communication mode.Wherein, serial communication mode refers to that each bit data of an information is by the communication modes transmitted in order by turn.
Thread is the minimum unit that program performs stream, and the thread of a standard is by Thread Id, and current instruction pointer (PC), set of registers and storehouse form.Thread is applicable to file management in server or Control on Communication.
Such as, when wireless communication module 40 receives the message of household electrical appliance transmission, this message is processed with serial communication mode, so that the message after process is reported to Cloud Server.
In one embodiment of the invention, this wireless communication module 40 also comprises network data receiving or sending thread 42, for communicating with Cloud Server.
Such as, when wireless communication module 40 receives the message of Cloud Server transmission by network data receiving or sending thread 42, this message is processed, so that the message after process is issued to household electrical appliance.
In one embodiment of the invention, this wireless communication module 40 also comprises service logic thread 43, for carrying out message with serial data receiving or sending thread 41, network data receiving or sending thread 42, control with the message of receiving and dispatching serial data receiving or sending thread 41 and network data receiving or sending thread 42.
Wherein, the service logic thread 43 in the embodiment of the present invention is the service logic thread 43 based on M-Smart system.The service content that M-Smart open system specifically provides, M-Smart system is for using third party cloud, the built-in cloud of use U.S., the open docking form of unclouded three kinds of the Internet partners.
Particularly, service logic thread 43 carries out message by M-Smart agreement and serial data receiving or sending thread 41, network data receiving or sending thread 42.
In one embodiment of the invention, this wireless communication module 40 also comprises main thread 44, and main thread 44 is for controlling serial data receiving or sending thread 41, network data receiving or sending thread 42 and service logic thread 43.
Alternatively, main thread 44 is for managing the state machine 48 of wireless communication module 40.
In one embodiment of the invention, this wireless communication module 40 also comprises application affairs readjustment submodule 45, and main thread 44 is by application affairs readjustment submodule 45 service control logic thread 43.
Wherein, application affairs message is generated by application affairs readjustment submodule 45 service control logic thread 43 by the main thread 44 in wireless communication module 40.
Particularly, application affairs message can be the event that the upper layer application of wireless communication module 40 initiatively produces, and such as, wireless communication module 40 cancels ap mode, then can produce the application affairs message of AF_EVT_AP_STOP.
In one embodiment of the invention, this wireless communication module 40 also comprises application affairs message queue 46, and for receiving event message, and read for main thread 44, wherein, event message comprises application affairs message and WIFI callback events message.
Such as, when Cloud Server issuing message, or during household electrical appliance reporting message, service logic thread 43 generates corresponding application affairs message, application affairs message is added in application affairs message queue 46 by service logic thread 43, reads this application affairs message to make main thread 44.
In one embodiment of the invention, this wireless communication module 40 also comprises state machine events distribution processor submodule 47, for event message being distributed to corresponding state machine 48 according to the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System, reads the application affairs message in application affairs message queue 46 and WIFI callback events message, the State Transferring mechanism of configuration wireless communication module 40.
Particularly, according to the mode attribute of event message, event message is distributed to corresponding state machine 48 by state machine events distribution processor submodule 47, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System.
Wireless communication module 40 supports focus (AccessPoint, AP) mode of operation AP-Mode, AP-Mode is applied in adding of WLAN (wireless local area network) member device (i.e. client), i.e. network downstream, there is provided and wirelessly set up WLAN (wireless local area network) WLAN, the central apparatus of suitable WLAN.Wireless communication module 40 also can support performance station Mode S TA-Mode, also can be understood as a work station in certain grid and client.When the WIFI chip of a wireless communication module 40 provides STA-Mode function, wireless communication module 40 just can be linked in the middle of an other network.AP-Mode is supplied to the connections such as mobile terminal, and STA-Mode is for providing the data uplink service of network.In addition, the grid state of wireless communication module 40 place system, namely wireless communication module 40 in systems in which with the network connection state of network user, can be described by system state dependency, the corresponding handover management being undertaken between system mode by System state machine.
Wherein, state machine 48 comprises AP-Mode state machine, STA-Mode state machine, and System state machine, the corresponding STA-Mode state machine of mode attribute AP-Mode corresponding A P-Mode state machine, mode attribute STA-Mode, and the corresponding System state machine of mode attribute System.
Particularly, application affairs message in application affairs message queue 46 and WIFI callback events message is read by the main thread 44 in wireless communication module 40 by state machine events distribution processor submodule 47.
Alternatively, state machine events distribution processor submodule 47 is also for by AP-Mode state machine, STA-Mode state machine, and the status attribute superposition of System state machine, to configure the State Transferring mechanism of wireless communication module 40.
Wherein, the status attribute of state machine 48 is for identifying the state of wireless communication module 40.
By this step, the plug-in in wireless communication module 40 can be made to call the status attribute configured, wireless communication module 40 can be switched between different states, realize the cooperating operation of three kinds of state machines in wireless communication module 40.
In one embodiment of the invention, this wireless communication module 40 also comprises state machine 48, switches for the state controlling wireless communication module 40 according to event message and State Transferring mechanism.
Alternatively, state machine 48 also for: if the mode attribute of event message is AP-Mode, then the AP-Mode state machine state that controls wireless communication module 40 according to the State Transferring mechanism of event message and AP-Mode state machine setting up in AP, AP run in and switch between idle three kinds of states; If the mode attribute of event message is STA-Mode, then STA-Mode state machine in this connection, has connected according to the machine-processed state controlling wireless communication module 40 of State Transferring of event message and STA-Mode state machine and has switched between idle three kinds of states; If the mode attribute of event message is System, then the state that System state machine controls wireless communication module 40 according to the State Transferring mechanism of event message and System state machine is not set up at network, network has been set up and switched between initialization three kinds of states.
Particularly, as shown in Figure 3, for wireless communication module in the embodiment of the present invention 40 state switches schematic diagram, wherein, comprise: AP-Mode state machine 31, STA-Mode state machine 32, System state machine 33, state machine events distribution processor submodule 34, application affairs message queue 35, AP-Mode state machine state switching flow 36, STA-Mode state machine state switching flow 37, and System state machine state switching flow 38.
Can switch according to the machine-processed state controlling wireless communication module 40 of State Transferring of the content of event message and corresponding state machine 48.
Such as, as shown in Figure 3, wireless communication module 40 cancels ap mode, then can produce AF_EVT_AP_STOP application affairs message, the content of this AF_EVT_AP_STOP application affairs message is for cancelling ap mode, when wireless communication module 40 is in the operating state of AP, and when the main thread of wireless communication module 40 reads this AF_EVT_AP_STOP application affairs message, AP-Mode state machine controls wireless communication module 40 and switches to idle state by the operating state of AP.
In one embodiment of the invention, this wireless communication module 40 also comprises WIFI event call-back submodule 49, for receiving WIFI callback events message, and after receiving WIFI callback events message, WIFI callback events message is added into application affairs message queue 46.
WIFI callback events message can be the event of the WIFI bottom feedback of wireless communication module 40.
Such as, the ap mode of wireless communication module 40 is opened successfully, then can produce the WIFI callback events message of AF_EVT_AP_STARTED_SUCCESS.
In the present embodiment, by event message being distributed to corresponding state machine according to the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-Mode, or any one in System, and switch according to the machine-processed state controlling wireless communication module of State Transferring of event message and corresponding state machine, the cooperating operation of three kinds of state machines in the wireless communication module of household electrical appliance can be realized, effectively promote the condition managing effect of wireless communication module.
It should be noted that, in describing the invention, term " first ", " second " etc. only for describing object, and can not be interpreted as instruction or hint relative importance.In addition, in describing the invention, except as otherwise noted, the implication of " multiple " is two or more.
Describe and can be understood in flow chart or in this any process otherwise described or method, represent and comprise one or more for realizing the module of the code of the executable instruction of the step of specific logical function or process, fragment or part, and the scope of the preferred embodiment of the present invention comprises other realization, wherein can not according to order that is shown or that discuss, comprise according to involved function by the mode while of basic or by contrary order, carry out n-back test, this should understand by embodiments of the invention person of ordinary skill in the field.
Should be appreciated that each several part of the present invention can realize with hardware, software, firmware or their combination.In the above-described embodiment, multiple step or method can with to store in memory and the software performed by suitable instruction execution system or firmware realize.Such as, if realized with hardware, the same in another embodiment, can realize by any one in following technology well known in the art or their combination: the discrete logic with the logic gates for realizing logic function to data-signal, there is the application-specific integrated circuit (ASIC) of suitable combinational logic gate circuit, programmable gate array (PGA), field programmable gate array (FPGA) etc.
Those skilled in the art are appreciated that realizing all or part of step that above-described embodiment method carries is that the hardware that can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, this program perform time, step comprising embodiment of the method one or a combination set of.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing module, also can be that the independent physics of unit exists, also can be integrated in a module by two or more unit.Above-mentioned integrated module both can adopt the form of hardware to realize, and the form of software function module also can be adopted to realize.If described integrated module using the form of software function module realize and as independently production marketing or use time, also can be stored in a computer read/write memory medium.
The above-mentioned storage medium mentioned can be read-only memory, disk or CD etc.
In the description of this specification, specific features, structure, material or feature that the description of reference term " embodiment ", " some embodiments ", " example ", " concrete example " or " some examples " etc. means to describe in conjunction with this embodiment or example are contained at least one embodiment of the present invention or example.In this manual, identical embodiment or example are not necessarily referred to the schematic representation of above-mentioned term.And the specific features of description, structure, material or feature can combine in an appropriate manner in any one or more embodiment or example.
Although illustrate and describe embodiments of the invention above, be understandable that, above-described embodiment is exemplary, can not be interpreted as limitation of the present invention, and those of ordinary skill in the art can change above-described embodiment within the scope of the invention, revises, replace and modification.