Git Product home page Git Product logo

phpanviz's Introduction

PHPAnviz

PHP library to access and control Anviz devices

Version

0.9.0

Installation

$ apt-get install gearman-job-server php5-gearman libgearman-dev

After the installation is done run gearman job server

$ gearmand -d

Set server permissions

$ chmod +x anviz-server

I'm recommending you to get Supervisor and run server with it or start the server mannually:

$ ./anviz-server_xYour_arch

You can download source of anviz-server here

Code & Functions

Before we start, open config.ini.example and change gearman-server address, save file and create config.ini

$ cp confing.ini.example config.ini

Get DateTime

<?php

require "PHPAnviz.php";
//third parameter is optional, if not set class uses default config.ini we've created earlier
$anviz = new PHPAnviz(1, 5010, "/path/to/optional/config/file.ini");

//format is optional, by default method getDateTime returns datetime in Y-m-d H:i:s format
echo $anviz->getDateTime("Y/m/d H:i:s");

Set DateTime

//parameter datetime is optional, if not set method will send current timestamp to device
$result = $anviz->setDateTime("2016-08-12 22:00:00"); //true if successful, false if failed

Get the firmware version, communication password, sleep time, volume, language, date and time format, attendance state, language setting flag, command version

$result = $anviz->getInfo1(); //array

Set the communication password, sleep time, volume, language, date format, attendance state, and language setting flag.

//returns true if successfull or false if failed
//pass 0xFF if you don't want to update paramete
$result = $anviz->setInfo1("12345", 10, 4, 1, 12, 0xFF, 0xFF); //true if success, false if failed

Get the T&A device Compare Precision, Fixed Wiegand Head Code, Wiegand Option, Work code permission, real-time mode setting, FP auto update setting, relay mode, Lock delay, Memory full alarm, Repeat attendance delay, door sensor delay, scheduled bell delay

$result = $anviz->getInfo2(); //array

Get the IP address, subnet Mask, MAC address, Default gateway, Server IP address,Far limit, Com port NO., TCP/IP mode, DHCP limit.

$result = $anviz->getTCPIPParameters(); //array

Get record information, including the amount of Used User, Used FP, Used Password, Used Card, All Attendance Record, and New Record.

$result = $anviz->getRecordInformation(); //array

Download Time attendance records

$result = $anviz->downloadTARecords(PHPAnviz::DOWNLOAD_NEW); //array of records

If you want to download all records pass PHPAnviz::DOWNLOAD_ALL or if you want to download new records only pass PHPAnviz::DOWNLOAD_NEW

Download staff information (users)

$result = $anviz->downloadStaffInfo(); //array of users

Upload staff information (users)

$users = array(
  0 => array(
    'user_id' => 1,
    'pwd' => '32015',
    'card_id' => '77421231',
    'name' => 'Test user 1',
    'department' => 0xFF,
    'group' => 1,
    'attendance_mode' => 0xFF,
    'pwd_8_digit' => 0xFF,
    'keep' => 0,
    'special_info' => 0xFF
  ),
  .
  .
  .
  n => array(
    'user_id' => n,
    'pwd' => '32235',
    'card_id' => '23521231',
    'name' => 'Test user n',
    'department' => 0xFF,
    'group' => 1,
    'attendance_mode' => 0xFF,
    'pwd_8_digit' => 0xFF,
    'keep' => 0,
    'special_info' => 0xFF
  ),
);

$anviz->uploadStaffInfo($users); //true if successful, false if failed

Download Fingerprint template

//first parameter is user id, second parameter is finger print (1 for FP1, 2 for FP2)
$template = $anviz->downloadFPTemplate(1, 1); //string

Get device id

$id = $anviz->getDeviceId(); //int

Set device id

$result = $anviz->setDeviceId(13); //true if successful, false if failed

Clear ALL users and their data

$result = $anviz->clearUsers(); //true if  successful, false if failed

Clear Time Attendance records

$result = $anviz->clearRecords(PHPAnviz::CLEAR_NEW_PARTIALY, 24); //true if successful, false if failed

PHPAnviz::CLEAR_ALL -> if you want to delete all records

PHPAnviz::CLEAR_NEW -> remove all "new record" signs

PHPAnviz::CLEAR_NEW_PARTIALY, int $n -> remove first $n "new records" signs

Force T&A device output signal to open door

$result = $anviz->openDoor(); //true if successful, false if failed

Get Attendance state table

$result = $anviz->getAttendanceStateTable(); //returns array of states (MAX 16)

Set Attendance state table

//MAX 16 elements
$states = array('IN', 'OUT', 'BREAK');

$result = $anviz->setTAStateTable($states); //true if successful, false if failed

phpanviz's People

Contributors

jtisler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.