You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
952 B
C++
47 lines
952 B
C++
//
|
|
// ±êÖ¾ÎïͨÐÅ - ½»Í¨µÆ£¨A/B£© - ZigBee
|
|
//
|
|
|
|
#include "TrafficLightCommand.h"
|
|
|
|
TrafficLightCommand::TrafficLightCommand()
|
|
{
|
|
SetDevice(CommandData::Devices::TrafficLight_A);
|
|
}
|
|
|
|
void TrafficLightCommand::UsingA()
|
|
{
|
|
SetDevice(CommandData::Devices::TrafficLight_A);
|
|
}
|
|
|
|
void TrafficLightCommand::UsingB()
|
|
{
|
|
SetDevice(CommandData::Devices::TrafficLight_B);
|
|
}
|
|
|
|
byte* TrafficLightCommand::CMD_EnterIdentifyMode()
|
|
{
|
|
SetCommand(0x01);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* TrafficLightCommand::CMD_CheckResult(Color color)
|
|
{
|
|
SetCommand(0x02, (byte)color);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
bool TrafficLightCommand::IsTrafficLightCommand(byte* cmd)
|
|
{
|
|
if ((cmd[1] == CommandData::Devices::TrafficLight_A) || (cmd[1] == CommandData::Devices::TrafficLight_B))
|
|
return (cmd[2] == 0x01);
|
|
return false;
|
|
}
|
|
|
|
bool TrafficLightCommand::ModeChangeSuccess(byte* cmd)
|
|
{
|
|
if (!IsTrafficLightCommand(cmd))
|
|
return false;
|
|
return ((cmd[3] == 0x01) && (cmd[4] == 0x07));
|
|
}
|