pcsc/php/pcsc.class.php
Johannes Findeisen 8db0824d92 Initial commit of the PC/SC (pcsc) extension. There is some stuff that needs to be romoved like the build.sh script and the subfolders tmp/ and php/.
I think the .m4 file has some bugs because it fails to build without my weird build.sh script. I will fix that ASAP.



git-svn-id: https://svn.php.net/repository/pecl/pcsc/trunk@320951 c90b9560-bf6c-de11-be94-00142212c4b1
2011-12-13 16:57:24 +00:00

55 lines
1.1 KiB
PHP

<?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);
}
}
?>