Commitb5e43338 by developer34

GPIO control and pause added

569076b2
... ... @@ -20,6 +20,10 @@ else
$ufr->readerUISignal(UFR1,2,2);//ReaderUISignal 2 2 sent to uFR Online 1
}
//$ufr->gpioControl(ONLINE, 3, LOW); //Set GPIO3 state to LOW
//$ufr->pause(ONLINE, 1000); //Pause for 1000ms
//$ufr->gpioControl(ONLINE, 3, HIGH); //Set GPIO3 state to HIGH
$ufr->sendResponse();//Sending HTTP response to uFR Online
... ...
... ... @@ -3,8 +3,12 @@ define("ONLINE", 0);
define(“UFR1”,1);
define("UFR2",2);
define("BARRIER",3);
define("DLIO",3);
define("ACT1",2);
define("ACT2",1);
define("LOW",0);
define("HIGH",1);
define("INPUT",2);
classUfr
{
private$serialNumber;
... ... @@ -74,6 +78,60 @@ class Ufr
}
}
protectedfunctionaddPause($readerNumber,$response)
{
if($readerNumber==0)
{
if($this->ufr0Response=="0")
{
$this->ufr0Response=$response;
}
else
{
$this->ufr0Response.=" ";
$this->ufr0Response.=$response;
}
}
elseif($readerNumber==1)
{
if($this->ufr1Response=="0")
{
$this->ufr1Response=$response;
}
else
{
$this->ufr1Response.=" ";
$this->ufr1Response.=$response;
}
}
elseif($readerNumber==2)
{
if($this->ufr2Response=="0")
{
$this->ufr2Response=$response;
}
else
{
$this->ufr2Response.=" ";
$this->ufr2Response.=$response;
}
}
elseif($readerNumber==3)
{
if($this->ufr3Response=="0")
{
$this->ufr3Response=$response;
}
else
{
$this->ufr3Response.=" ";
$this->ufr3Response.=$response;
}
}
}
protectedfunctionbyteArray2Hex($byteArray){
$chars=array_map("chr",$byteArray);
$bin=join($chars);
... ... @@ -306,4 +364,20 @@ class Ufr
return1;
}
functiongpioControl($readerNumber,$gpio,$state)
{
$data=array(0x55,0xF3,0xAA,0x00,0xFF,0xFF,0xFF);
$data[4]=$gpio;
$data[5]=$state;
$data[6]=$this->calculateChecksum($data,6);
$this->addResponse($readerNumber,$data);
return1;
}
functionpause($readerNumber,$duration)
{
$this->addPause($readerNumber,"P".$duration);
return1;
}
}
    Markdownis supported
    0%or
    You are about to add0peopleto the discussion. Proceed with caution.
    Finish editing this message first!
    Pleaseregisteror发表评论
    Baidu
    map