mirror of
https://github.com/pcsc-for-php/pcsc.git
synced 2026-08-08 21:09:26 +02:00
Added some new directory structure and removed all temporary and obselete stuff.
git-svn-id: https://svn.php.net/repository/pecl/pcsc/trunk@320997 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
8db0824d92
commit
1f19de4b84
4 changed files with 58 additions and 496 deletions
55
docs/examples/pcsc.class.php
Normal file
55
docs/examples/pcsc.class.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/*
|
||||
* Don't use this! this is a raw and dirty written class just for testing some
|
||||
* stuff... Johannes
|
||||
*/
|
||||
|
||||
class PCSC {
|
||||
|
||||
public $context;
|
||||
public $card;
|
||||
public $readers;
|
||||
public $connection;
|
||||
|
||||
function __construct() {
|
||||
$this->context = scard_establish_context();
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->context = scard_release_context($this->context);
|
||||
}
|
||||
|
||||
function connect($reader) {
|
||||
return $this->connection = scard_connect($this->context, $reader);
|
||||
}
|
||||
|
||||
/*function reconnect() {
|
||||
return $this->connection = scard_reconnect($this->connection);
|
||||
}*/
|
||||
|
||||
function disconnect() {
|
||||
return scard_disconnect($this->connection);
|
||||
}
|
||||
|
||||
function listreaders() {
|
||||
return $this->readers = scard_list_readers($this->context);
|
||||
}
|
||||
|
||||
function transmit($apdu) {
|
||||
return scard_transmit($this->connection, $apdu);
|
||||
}
|
||||
|
||||
function isvalidcontext() {
|
||||
return scard_is_valid_context($this->context);
|
||||
}
|
||||
|
||||
function releasecontext() {
|
||||
return scard_release_context($this->context);
|
||||
}
|
||||
|
||||
function status() {
|
||||
return scard_status($this->connection);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
43
docs/examples/test.php
Normal file
43
docs/examples/test.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/* Just a test script for checking the implementation... */
|
||||
|
||||
if (!extension_loaded('pcsc')) {
|
||||
dl('pcsc.so');
|
||||
}
|
||||
|
||||
include("./pcsc.class.php");
|
||||
|
||||
$foo = new PCSC();
|
||||
|
||||
echo "Create Context:\n";
|
||||
var_dump($foo->context);
|
||||
|
||||
echo "List Readers:\n";
|
||||
var_dump($foo->listreaders());
|
||||
|
||||
echo "Connect Card:\n";
|
||||
var_dump($foo->connect("OMNIKEY CardMan 5x21 00 01"));
|
||||
|
||||
#echo "Reconnect:\n";
|
||||
#var_dump($foo->reconnect());
|
||||
|
||||
echo "Some Transmits:\n";
|
||||
var_dump($foo->transmit("00a4040c0cD2760001354B414E4D30310000"));
|
||||
var_dump($foo->transmit("0084000008"));
|
||||
var_dump($foo->transmit("0084000008"));
|
||||
var_dump($foo->transmit("0084000008"));
|
||||
|
||||
echo "Is Valid Context?\n";
|
||||
var_dump($foo->isvalidcontext());
|
||||
|
||||
echo "Status:\n";
|
||||
var_dump($foo->status());
|
||||
|
||||
echo "Disconnect Card:\n";
|
||||
var_dump($foo->disconnect());
|
||||
|
||||
echo "Release Context:\n";
|
||||
var_dump($foo->releasecontext());
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue