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.
99 lines
1.6 KiB
C++
99 lines
1.6 KiB
C++
//
|
|
// ±êÖ¾ÎïͨÐÅ - ³µ¿â£¨A/B£© - ZigBee
|
|
//
|
|
|
|
#include "GarageCommand.h"
|
|
|
|
GarageCommand::GarageCommand()
|
|
{
|
|
SetDevice(CommandData::Devices::Garage_A);
|
|
}
|
|
|
|
void GarageCommand::UsingA()
|
|
{
|
|
SetDevice(CommandData::Devices::Garage_A);
|
|
}
|
|
|
|
void GarageCommand::UsingB()
|
|
{
|
|
SetDevice(CommandData::Devices::Garage_B);
|
|
}
|
|
|
|
byte* GarageCommand::CMD_PositionReset()
|
|
{
|
|
SetCommand(0x01, 0x01);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* GarageCommand::CMD_SetToFloor2()
|
|
{
|
|
SetCommand(0x01, 0x02);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* GarageCommand::CMD_SetToFloor3()
|
|
{
|
|
SetCommand(0x01, 0x03);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* GarageCommand::CMD_SetToFloor4()
|
|
{
|
|
SetCommand(0x01, 0x04);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* GarageCommand::CMD_SetToFloor(uint8_t floor)
|
|
{
|
|
SetCommand(0x01, floor);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* GarageCommand::CMD_QueryCurrentPos()
|
|
{
|
|
SetCommand(0x02, 0x01);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
byte* GarageCommand::CMD_QueryIRStatus()
|
|
{
|
|
SetCommand(0x02, 0x02);
|
|
return GetCommandArray();
|
|
}
|
|
|
|
bool GarageCommand::IsGarageCommand(byte* data)
|
|
{
|
|
if ((data[1] == CommandData::Devices::Garage_A) || (data[1] == CommandData::Devices::Garage_B))
|
|
return (data[2] == ReturnMainCommand);
|
|
return false;
|
|
}
|
|
|
|
bool GarageCommand::IsPositionData(byte* data)
|
|
{
|
|
if (!IsGarageCommand(data))
|
|
return false;
|
|
return (data[3] == 0x01);
|
|
}
|
|
|
|
bool GarageCommand::IsIRData(byte* data)
|
|
{
|
|
if (!IsGarageCommand(data))
|
|
return false;
|
|
return (data[3] == 0x02);
|
|
}
|
|
|
|
byte GarageCommand::CurrentPos(byte* data)
|
|
{
|
|
return data[4];
|
|
}
|
|
|
|
bool GarageCommand::FrontIRTiggered(byte* data)
|
|
{
|
|
return (data[4] == 0x01);
|
|
}
|
|
|
|
bool GarageCommand::BackIRTiggered(byte* data)
|
|
{
|
|
return (data[5] == 0x01);
|
|
}
|