Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
ufr_online-examples-php-master_mode
Project
Overview
Details
活动ty
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
管道
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
活动ty
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nfc-rfid-reader-sdk
ufr_online-examples-php-master_mode
Commits
b5e43338
Commit
b5e43338
撰写
Mar 16, 2022
by
developer34
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GPIO control and pause added
父
569076b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
index.php
index.php
+4
-0
ufr.php
lib/ufr.php
+74
-0
No files found.
index.php
View file @
b5e43338
...
...
@@ -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
...
...
lib/ufr.php
View file @
b5e43338
...
...
@@ -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
);
class
Ufr
{
private
$serialNumber
;
...
...
@@ -74,6 +78,60 @@ class Ufr
}
}
protected
function
addPause
(
$readerNumber
,
$response
)
{
if
(
$readerNumber
==
0
)
{
if
(
$this
->
ufr0Response
==
"0"
)
{
$this
->
ufr0Response
=
$response
;
}
else
{
$this
->
ufr0Response
.=
" "
;
$this
->
ufr0Response
.=
$response
;
}
}
else
if
(
$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
;
}
}
}
protected
function
byteArray2Hex
(
$byteArray
)
{
$chars
=
array_map
(
"chr"
,
$byteArray
);
$bin
=
join
(
$chars
);
...
...
@@ -306,4 +364,20 @@ class Ufr
return
1
;
}
function
gpioControl
(
$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
);
return
1
;
}
function
pause
(
$readerNumber
,
$duration
)
{
$this
->
addPause
(
$readerNumber
,
"P"
.
$duration
);
return
1
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
发表评论
map