Permalink
Browse files

Fixed non-idempotent unpack_state / pack_state in ReaderStateQuery. N…

…icer error display.
  • Loading branch information...
pwnall committed Feb 9, 2012
1 parent 752e0af commit 762a57163d8bad5a337e87794e697b74f0c2905f
View
@@ -5,13 +5,19 @@
<projects>
</projects>
<buildSpec>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
<buildCommand>
<name>org.rubypeople.rdt.core.rubybuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
+ <nature>com.aptana.ruby.core.rubynature</nature>
<nature>org.rubypeople.rdt.core.rubynature</nature>
</natures>
</projectDescription>
View
@@ -1,7 +1,7 @@
require 'rubygems'
require 'echoe'
-require 'tasks/ffi_codegen.rb'
+require './tasks/ffi_codegen.rb'
Echoe.new('smartcard') do |p|
p.project = 'smartcard' # rubyforge project
View
@@ -4,11 +4,11 @@ module Smartcard
require 'smartcard/pcsc/card.rb'
require 'smartcard/pcsc/context.rb'
+require 'smartcard/pcsc/exception.rb'
require 'smartcard/pcsc/ffi_lib.rb'
require 'smartcard/pcsc/ffi_autogen.rb'
require 'smartcard/pcsc/ffi_structs.rb'
require 'smartcard/pcsc/ffi_functions.rb'
-require 'smartcard/pcsc/pcsc_exception.rb'
require 'smartcard/pcsc/reader_state_queries.rb'
require 'smartcard/iso/apdu_error.rb'
@@ -0,0 +1,15 @@
+# Contains information about an exception at the PC/SC layer.
+class Smartcard::PCSC::Exception < RuntimeError
+ def initialize(error_status)
+ @pcsc_status_code = 2**32 + error_status
+ @pcsc_status = Smartcard::PCSC::FFILib::Status.find @pcsc_status_code
+
+ super "#{@pcsc_status} (0x#{@pcsc_status_code.to_s(16)})"
+ end
+
+ # Symbol for the PC/SC error status that caused this error.
+ attr_reader :pcsc_status
+
+ # The PC/SC error status that caused this error, as a number.
+ attr_reader :pcsc_status_code
+end
Oops, something went wrong.

0 comments on commit 762a571

Please sign in to comment.