|
|
|
@@ -4,59 +4,59 @@
|
|
|
|
using namespace v8;
|
|
|
|
using namespace v8;
|
|
|
|
using namespace node;
|
|
|
|
using namespace node;
|
|
|
|
|
|
|
|
|
|
|
|
Persistent<Function> CardReader::constructor;
|
|
|
|
Nan::Persistent<Function> CardReader::constructor;
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::init(Handle<Object> target) {
|
|
|
|
void CardReader::init(Handle<Object> target) {
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare constructor template
|
|
|
|
// Prepare constructor template
|
|
|
|
Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
|
|
|
|
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(New);
|
|
|
|
tpl->SetClassName(NanNew("CardReader"));
|
|
|
|
tpl->SetClassName(Nan::New("CardReader").ToLocalChecked());
|
|
|
|
tpl->InstanceTemplate()->SetInternalFieldCount(1);
|
|
|
|
tpl->InstanceTemplate()->SetInternalFieldCount(1);
|
|
|
|
|
|
|
|
|
|
|
|
// Symbol
|
|
|
|
// Symbol
|
|
|
|
NanAssignPersistent(name_symbol, NanNew("name"));
|
|
|
|
name_symbol.Reset(Nan::New("name").ToLocalChecked());
|
|
|
|
NanAssignPersistent(connected_symbol, NanNew("connected"));
|
|
|
|
connected_symbol.Reset(Nan::New("connected").ToLocalChecked());
|
|
|
|
|
|
|
|
|
|
|
|
// Prototype
|
|
|
|
// Prototype
|
|
|
|
NanSetPrototypeTemplate(tpl, "get_status", NanNew<FunctionTemplate>(GetStatus));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "get_status", Nan::New<FunctionTemplate>(GetStatus));
|
|
|
|
NanSetPrototypeTemplate(tpl, "_connect", NanNew<FunctionTemplate>(Connect));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "_connect", Nan::New<FunctionTemplate>(Connect));
|
|
|
|
NanSetPrototypeTemplate(tpl, "_disconnect", NanNew<FunctionTemplate>(Disconnect));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "_disconnect", Nan::New<FunctionTemplate>(Disconnect));
|
|
|
|
NanSetPrototypeTemplate(tpl, "_transmit", NanNew<FunctionTemplate>(Transmit));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "_transmit", Nan::New<FunctionTemplate>(Transmit));
|
|
|
|
NanSetPrototypeTemplate(tpl, "_control", NanNew<FunctionTemplate>(Control));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "_control", Nan::New<FunctionTemplate>(Control));
|
|
|
|
NanSetPrototypeTemplate(tpl, "close", NanNew<FunctionTemplate>(Close));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "close", Nan::New<FunctionTemplate>(Close));
|
|
|
|
|
|
|
|
|
|
|
|
// PCSCLite constants
|
|
|
|
// PCSCLite constants
|
|
|
|
// Share Mode
|
|
|
|
// Share Mode
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_SHARE_SHARED", NanNew(SCARD_SHARE_SHARED));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_SHARE_SHARED", Nan::New(SCARD_SHARE_SHARED));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_SHARE_EXCLUSIVE", NanNew(SCARD_SHARE_EXCLUSIVE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_SHARE_EXCLUSIVE", Nan::New(SCARD_SHARE_EXCLUSIVE));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_SHARE_DIRECT", NanNew(SCARD_SHARE_DIRECT));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_SHARE_DIRECT", Nan::New(SCARD_SHARE_DIRECT));
|
|
|
|
|
|
|
|
|
|
|
|
// Protocol
|
|
|
|
// Protocol
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_PROTOCOL_T0", NanNew(SCARD_PROTOCOL_T0));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_PROTOCOL_T0", Nan::New(SCARD_PROTOCOL_T0));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_PROTOCOL_T1", NanNew(SCARD_PROTOCOL_T1));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_PROTOCOL_T1", Nan::New(SCARD_PROTOCOL_T1));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_PROTOCOL_RAW", NanNew(SCARD_PROTOCOL_RAW));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_PROTOCOL_RAW", Nan::New(SCARD_PROTOCOL_RAW));
|
|
|
|
|
|
|
|
|
|
|
|
// State
|
|
|
|
// State
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_UNAWARE", NanNew(SCARD_STATE_UNAWARE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_UNAWARE", Nan::New(SCARD_STATE_UNAWARE));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_IGNORE", NanNew(SCARD_STATE_IGNORE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_IGNORE", Nan::New(SCARD_STATE_IGNORE));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_CHANGED", NanNew(SCARD_STATE_CHANGED));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_CHANGED", Nan::New(SCARD_STATE_CHANGED));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_UNKNOWN", NanNew(SCARD_STATE_UNKNOWN));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_UNKNOWN", Nan::New(SCARD_STATE_UNKNOWN));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_UNAVAILABLE", NanNew(SCARD_STATE_UNAVAILABLE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_UNAVAILABLE", Nan::New(SCARD_STATE_UNAVAILABLE));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_EMPTY", NanNew(SCARD_STATE_EMPTY));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_EMPTY", Nan::New(SCARD_STATE_EMPTY));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_PRESENT", NanNew(SCARD_STATE_PRESENT));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_PRESENT", Nan::New(SCARD_STATE_PRESENT));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_ATRMATCH", NanNew(SCARD_STATE_ATRMATCH));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_ATRMATCH", Nan::New(SCARD_STATE_ATRMATCH));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_EXCLUSIVE", NanNew(SCARD_STATE_EXCLUSIVE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_EXCLUSIVE", Nan::New(SCARD_STATE_EXCLUSIVE));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_INUSE", NanNew(SCARD_STATE_INUSE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_INUSE", Nan::New(SCARD_STATE_INUSE));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_STATE_MUTE", NanNew(SCARD_STATE_MUTE));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_STATE_MUTE", Nan::New(SCARD_STATE_MUTE));
|
|
|
|
|
|
|
|
|
|
|
|
// Disconnect disposition
|
|
|
|
// Disconnect disposition
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_LEAVE_CARD", NanNew(SCARD_LEAVE_CARD));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_LEAVE_CARD", Nan::New(SCARD_LEAVE_CARD));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_RESET_CARD", NanNew(SCARD_RESET_CARD));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_RESET_CARD", Nan::New(SCARD_RESET_CARD));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_UNPOWER_CARD", NanNew(SCARD_UNPOWER_CARD));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_UNPOWER_CARD", Nan::New(SCARD_UNPOWER_CARD));
|
|
|
|
NanSetPrototypeTemplate(tpl, "SCARD_EJECT_CARD", NanNew(SCARD_EJECT_CARD));
|
|
|
|
Nan::SetPrototypeTemplate(tpl, "SCARD_EJECT_CARD", Nan::New(SCARD_EJECT_CARD));
|
|
|
|
|
|
|
|
|
|
|
|
NanAssignPersistent<Function>(constructor, tpl->GetFunction());
|
|
|
|
constructor.Reset(tpl->GetFunction());
|
|
|
|
target->Set(NanNew("CardReader"), tpl->GetFunction());
|
|
|
|
target->Set(Nan::New("CardReader").ToLocalChecked(), tpl->GetFunction());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CardReader::CardReader(const std::string &reader_name): m_card_context(0),
|
|
|
|
CardReader::CardReader(const std::string &reader_name): m_card_context(0),
|
|
|
|
@@ -81,63 +81,63 @@ CardReader::~CardReader() {
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::New) {
|
|
|
|
NAN_METHOD(CardReader::New) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
v8::String::Utf8Value reader_name(args[0]->ToString());
|
|
|
|
v8::String::Utf8Value reader_name(info[0]->ToString());
|
|
|
|
CardReader* obj = new CardReader(*reader_name);
|
|
|
|
CardReader* obj = new CardReader(*reader_name);
|
|
|
|
obj->Wrap(args.Holder());
|
|
|
|
obj->Wrap(info.Holder());
|
|
|
|
NanObjectWrapHandle(obj)->Set(NanNew(name_symbol), args[0]->ToString());
|
|
|
|
obj->handle()->Set(Nan::New(name_symbol), info[0]->ToString());
|
|
|
|
NanObjectWrapHandle(obj)->Set(NanNew(connected_symbol), NanFalse());
|
|
|
|
obj->handle()->Set(Nan::New(connected_symbol), Nan::False());
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnValue(args.Holder());
|
|
|
|
info.GetReturnValue().Set(info.Holder());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::GetStatus) {
|
|
|
|
NAN_METHOD(CardReader::GetStatus) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
CardReader* obj = ObjectWrap::Unwrap<CardReader>(args.This());
|
|
|
|
CardReader* obj = Nan::ObjectWrap::Unwrap<CardReader>(info.This());
|
|
|
|
Local<Function> cb = Local<Function>::Cast(args[0]);
|
|
|
|
Local<Function> cb = Local<Function>::Cast(info[0]);
|
|
|
|
|
|
|
|
|
|
|
|
AsyncBaton *async_baton = new AsyncBaton();
|
|
|
|
AsyncBaton *async_baton = new AsyncBaton();
|
|
|
|
async_baton->async.data = async_baton;
|
|
|
|
async_baton->async.data = async_baton;
|
|
|
|
NanAssignPersistent(async_baton->callback, cb);
|
|
|
|
async_baton->callback.Reset(cb);
|
|
|
|
async_baton->reader = obj;
|
|
|
|
async_baton->reader = obj;
|
|
|
|
|
|
|
|
|
|
|
|
uv_async_init(uv_default_loop(), &async_baton->async, (uv_async_cb)HandleReaderStatusChange);
|
|
|
|
uv_async_init(uv_default_loop(), &async_baton->async, (uv_async_cb)HandleReaderStatusChange);
|
|
|
|
int ret = uv_thread_create(&obj->m_status_thread, HandlerFunction, async_baton);
|
|
|
|
int ret = uv_thread_create(&obj->m_status_thread, HandlerFunction, async_baton);
|
|
|
|
assert(ret == 0);
|
|
|
|
assert(ret == 0);
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnUndefined();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::Connect) {
|
|
|
|
NAN_METHOD(CardReader::Connect) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
// The second argument is the length of the data to be received
|
|
|
|
// The second argument is the length of the data to be received
|
|
|
|
if (!args[0]->IsUint32()) {
|
|
|
|
if (!info[0]->IsUint32()) {
|
|
|
|
return NanThrowError("First argument must be an integer");
|
|
|
|
return Nan::ThrowError("First argument must be an integer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!args[1]->IsUint32()) {
|
|
|
|
if (!info[1]->IsUint32()) {
|
|
|
|
return NanThrowError("Second argument must be an integer");
|
|
|
|
return Nan::ThrowError("Second argument must be an integer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!args[2]->IsFunction()) {
|
|
|
|
if (!info[2]->IsFunction()) {
|
|
|
|
return NanThrowError("Third argument must be a callback function");
|
|
|
|
return Nan::ThrowError("Third argument must be a callback function");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ConnectInput* ci = new ConnectInput();
|
|
|
|
ConnectInput* ci = new ConnectInput();
|
|
|
|
ci->share_mode = args[0]->Uint32Value();
|
|
|
|
ci->share_mode = info[0]->Uint32Value();
|
|
|
|
ci->pref_protocol = args[1]->Uint32Value();
|
|
|
|
ci->pref_protocol = info[1]->Uint32Value();
|
|
|
|
Local<Function> cb = Local<Function>::Cast(args[2]);
|
|
|
|
Local<Function> cb = Local<Function>::Cast(info[2]);
|
|
|
|
|
|
|
|
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
baton->request.data = baton;
|
|
|
|
baton->request.data = baton;
|
|
|
|
NanAssignPersistent(baton->callback, cb);
|
|
|
|
baton->callback.Reset(cb);
|
|
|
|
baton->reader = ObjectWrap::Unwrap<CardReader>(args.This());
|
|
|
|
baton->reader = Nan::ObjectWrap::Unwrap<CardReader>(info.This());
|
|
|
|
baton->input = ci;
|
|
|
|
baton->input = ci;
|
|
|
|
|
|
|
|
|
|
|
|
// Schedule our work request with libuv. Here you can specify the functions
|
|
|
|
// Schedule our work request with libuv. Here you can specify the functions
|
|
|
|
@@ -149,30 +149,30 @@ NAN_METHOD(CardReader::Connect) {
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterConnect));
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterConnect));
|
|
|
|
assert(status == 0);
|
|
|
|
assert(status == 0);
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnUndefined();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::Disconnect) {
|
|
|
|
NAN_METHOD(CardReader::Disconnect) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
if (!args[0]->IsUint32()) {
|
|
|
|
if (!info[0]->IsUint32()) {
|
|
|
|
return NanThrowError("First argument must be an integer");
|
|
|
|
return Nan::ThrowError("First argument must be an integer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!args[1]->IsFunction()) {
|
|
|
|
if (!info[1]->IsFunction()) {
|
|
|
|
return NanThrowError("Second argument must be a callback function");
|
|
|
|
return Nan::ThrowError("Second argument must be a callback function");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD disposition = args[0]->Uint32Value();
|
|
|
|
DWORD disposition = info[0]->Uint32Value();
|
|
|
|
Local<Function> cb = Local<Function>::Cast(args[1]);
|
|
|
|
Local<Function> cb = Local<Function>::Cast(info[1]);
|
|
|
|
|
|
|
|
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
baton->input = reinterpret_cast<void*>(new DWORD(disposition));
|
|
|
|
baton->input = reinterpret_cast<void*>(new DWORD(disposition));
|
|
|
|
baton->request.data = baton;
|
|
|
|
baton->request.data = baton;
|
|
|
|
NanAssignPersistent(baton->callback, cb);
|
|
|
|
baton->callback.Reset(cb);
|
|
|
|
baton->reader = ObjectWrap::Unwrap<CardReader>(args.This());
|
|
|
|
baton->reader = Nan::ObjectWrap::Unwrap<CardReader>(info.This());
|
|
|
|
|
|
|
|
|
|
|
|
// Schedule our work request with libuv. Here you can specify the functions
|
|
|
|
// Schedule our work request with libuv. Here you can specify the functions
|
|
|
|
// that should be executed in the threadpool and back in the main thread
|
|
|
|
// that should be executed in the threadpool and back in the main thread
|
|
|
|
@@ -183,43 +183,43 @@ NAN_METHOD(CardReader::Disconnect) {
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterDisconnect));
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterDisconnect));
|
|
|
|
assert(status == 0);
|
|
|
|
assert(status == 0);
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnUndefined();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::Transmit) {
|
|
|
|
NAN_METHOD(CardReader::Transmit) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
// The first argument is the buffer to be transmitted.
|
|
|
|
// The first argument is the buffer to be transmitted.
|
|
|
|
if (!Buffer::HasInstance(args[0])) {
|
|
|
|
if (!Buffer::HasInstance(info[0])) {
|
|
|
|
return NanThrowError("First argument must be a Buffer");
|
|
|
|
return Nan::ThrowError("First argument must be a Buffer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The second argument is the length of the data to be received
|
|
|
|
// The second argument is the length of the data to be received
|
|
|
|
if (!args[1]->IsUint32()) {
|
|
|
|
if (!info[1]->IsUint32()) {
|
|
|
|
return NanThrowError("Second argument must be an integer");
|
|
|
|
return Nan::ThrowError("Second argument must be an integer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The third argument is the protocol to be used
|
|
|
|
// The third argument is the protocol to be used
|
|
|
|
if (!args[2]->IsUint32()) {
|
|
|
|
if (!info[2]->IsUint32()) {
|
|
|
|
return NanThrowError("Third argument must be an integer");
|
|
|
|
return Nan::ThrowError("Third argument must be an integer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The fourth argument is the callback function
|
|
|
|
// The fourth argument is the callback function
|
|
|
|
if (!args[3]->IsFunction()) {
|
|
|
|
if (!info[3]->IsFunction()) {
|
|
|
|
return NanThrowError("Fourth argument must be a callback function");
|
|
|
|
return Nan::ThrowError("Fourth argument must be a callback function");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Local<Object> buffer_data = args[0]->ToObject();
|
|
|
|
Local<Object> buffer_data = info[0]->ToObject();
|
|
|
|
uint32_t out_len = args[1]->Uint32Value();
|
|
|
|
uint32_t out_len = info[1]->Uint32Value();
|
|
|
|
uint32_t protocol = args[2]->Uint32Value();
|
|
|
|
uint32_t protocol = info[2]->Uint32Value();
|
|
|
|
Local<Function> cb = Local<Function>::Cast(args[3]);
|
|
|
|
Local<Function> cb = Local<Function>::Cast(info[3]);
|
|
|
|
|
|
|
|
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
baton->request.data = baton;
|
|
|
|
baton->request.data = baton;
|
|
|
|
NanAssignPersistent(baton->callback, cb);
|
|
|
|
baton->callback.Reset(cb);
|
|
|
|
baton->reader = ObjectWrap::Unwrap<CardReader>(args.This());
|
|
|
|
baton->reader = Nan::ObjectWrap::Unwrap<CardReader>(info.This());
|
|
|
|
TransmitInput *ti = new TransmitInput();
|
|
|
|
TransmitInput *ti = new TransmitInput();
|
|
|
|
ti->card_protocol = protocol;
|
|
|
|
ti->card_protocol = protocol;
|
|
|
|
ti->in_data = new unsigned char[Buffer::Length(buffer_data)];
|
|
|
|
ti->in_data = new unsigned char[Buffer::Length(buffer_data)];
|
|
|
|
@@ -238,43 +238,43 @@ NAN_METHOD(CardReader::Transmit) {
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterTransmit));
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterTransmit));
|
|
|
|
assert(status == 0);
|
|
|
|
assert(status == 0);
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnUndefined();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::Control) {
|
|
|
|
NAN_METHOD(CardReader::Control) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
// The first argument is the buffer to be transmitted.
|
|
|
|
// The first argument is the buffer to be transmitted.
|
|
|
|
if (!Buffer::HasInstance(args[0])) {
|
|
|
|
if (!Buffer::HasInstance(info[0])) {
|
|
|
|
return NanThrowError("First argument must be a Buffer");
|
|
|
|
return Nan::ThrowError("First argument must be a Buffer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The second argument is the control code to be used
|
|
|
|
// The second argument is the control code to be used
|
|
|
|
if (!args[1]->IsUint32()) {
|
|
|
|
if (!info[1]->IsUint32()) {
|
|
|
|
return NanThrowError("Second argument must be an integer");
|
|
|
|
return Nan::ThrowError("Second argument must be an integer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The third argument is output buffer
|
|
|
|
// The third argument is output buffer
|
|
|
|
if (!Buffer::HasInstance(args[2])) {
|
|
|
|
if (!Buffer::HasInstance(info[2])) {
|
|
|
|
return NanThrowError("Third argument must be a Buffer");
|
|
|
|
return Nan::ThrowError("Third argument must be a Buffer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The fourth argument is the callback function
|
|
|
|
// The fourth argument is the callback function
|
|
|
|
if (!args[3]->IsFunction()) {
|
|
|
|
if (!info[3]->IsFunction()) {
|
|
|
|
return NanThrowError("Fourth argument must be a callback function");
|
|
|
|
return Nan::ThrowError("Fourth argument must be a callback function");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Local<Object> in_buf = args[0]->ToObject();
|
|
|
|
Local<Object> in_buf = info[0]->ToObject();
|
|
|
|
DWORD control_code = args[1]->Uint32Value();
|
|
|
|
DWORD control_code = info[1]->Uint32Value();
|
|
|
|
Local<Object> out_buf = args[2]->ToObject();
|
|
|
|
Local<Object> out_buf = info[2]->ToObject();
|
|
|
|
Local<Function> cb = Local<Function>::Cast(args[3]);
|
|
|
|
Local<Function> cb = Local<Function>::Cast(info[3]);
|
|
|
|
|
|
|
|
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
// This creates our work request, including the libuv struct.
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
Baton* baton = new Baton();
|
|
|
|
baton->request.data = baton;
|
|
|
|
baton->request.data = baton;
|
|
|
|
NanAssignPersistent(baton->callback, cb);
|
|
|
|
baton->callback.Reset(cb);
|
|
|
|
baton->reader = ObjectWrap::Unwrap<CardReader>(args.This());
|
|
|
|
baton->reader = Nan::ObjectWrap::Unwrap<CardReader>(info.This());
|
|
|
|
ControlInput *ci = new ControlInput();
|
|
|
|
ControlInput *ci = new ControlInput();
|
|
|
|
ci->control_code = control_code;
|
|
|
|
ci->control_code = control_code;
|
|
|
|
ci->in_data = Buffer::Data(in_buf);
|
|
|
|
ci->in_data = Buffer::Data(in_buf);
|
|
|
|
@@ -292,15 +292,15 @@ NAN_METHOD(CardReader::Control) {
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterControl));
|
|
|
|
reinterpret_cast<uv_after_work_cb>(AfterControl));
|
|
|
|
assert(status == 0);
|
|
|
|
assert(status == 0);
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnUndefined();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NAN_METHOD(CardReader::Close) {
|
|
|
|
NAN_METHOD(CardReader::Close) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
LONG result = SCARD_S_SUCCESS;
|
|
|
|
LONG result = SCARD_S_SUCCESS;
|
|
|
|
CardReader* obj = ObjectWrap::Unwrap<CardReader>(args.This());
|
|
|
|
CardReader* obj = Nan::ObjectWrap::Unwrap<CardReader>(info.This());
|
|
|
|
|
|
|
|
|
|
|
|
uv_mutex_lock(&obj->m_mutex);
|
|
|
|
uv_mutex_lock(&obj->m_mutex);
|
|
|
|
if (obj->m_state == 0) {
|
|
|
|
if (obj->m_state == 0) {
|
|
|
|
@@ -317,12 +317,12 @@ NAN_METHOD(CardReader::Close) {
|
|
|
|
assert(uv_thread_join(&obj->m_status_thread) == 0);
|
|
|
|
assert(uv_thread_join(&obj->m_status_thread) == 0);
|
|
|
|
obj->m_status_thread = 0;
|
|
|
|
obj->m_status_thread = 0;
|
|
|
|
|
|
|
|
|
|
|
|
NanReturnValue(NanNew<Number>(result));
|
|
|
|
info.GetReturnValue().Set(Nan::New<Number>(result));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::HandleReaderStatusChange(uv_async_t *handle, int status) {
|
|
|
|
void CardReader::HandleReaderStatusChange(uv_async_t *handle, int status) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
|
|
|
|
|
|
|
|
AsyncBaton* async_baton = static_cast<AsyncBaton*>(handle->data);
|
|
|
|
AsyncBaton* async_baton = static_cast<AsyncBaton*>(handle->data);
|
|
|
|
AsyncResult* ar = async_baton->async_result;
|
|
|
|
AsyncResult* ar = async_baton->async_result;
|
|
|
|
@@ -331,29 +331,29 @@ void CardReader::HandleReaderStatusChange(uv_async_t *handle, int status) {
|
|
|
|
uv_close(reinterpret_cast<uv_handle_t*>(&async_baton->async), CloseCallback); // necessary otherwise UV will block
|
|
|
|
uv_close(reinterpret_cast<uv_handle_t*>(&async_baton->async), CloseCallback); // necessary otherwise UV will block
|
|
|
|
|
|
|
|
|
|
|
|
/* Emit end event */
|
|
|
|
/* Emit end event */
|
|
|
|
Handle<Value> argv[1] = {
|
|
|
|
Local<Value> argv[1] = {
|
|
|
|
NanNew("_end"), // event name
|
|
|
|
Nan::New("_end").ToLocalChecked(), // event name
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NanMakeCallback(NanObjectWrapHandle(async_baton->reader), "emit", 1, argv);
|
|
|
|
Nan::MakeCallback(async_baton->reader->handle(), "emit", 1, argv);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ar->result == SCARD_S_SUCCESS) {
|
|
|
|
if (ar->result == SCARD_S_SUCCESS) {
|
|
|
|
const unsigned argc = 3;
|
|
|
|
const unsigned argc = 3;
|
|
|
|
Handle<Value> argv[argc] = {
|
|
|
|
Local<Value> argv[argc] = {
|
|
|
|
NanUndefined(), // argument
|
|
|
|
Nan::Undefined(), // argument
|
|
|
|
NanNew<Number>(ar->status),
|
|
|
|
Nan::New<Number>(ar->status),
|
|
|
|
NanNewBufferHandle(reinterpret_cast<char*>(ar->atr), ar->atrlen)
|
|
|
|
Nan::NewBuffer(reinterpret_cast<char*>(ar->atr), ar->atrlen).ToLocalChecked()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NanCallback(NanNew(async_baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(async_baton->callback)).Call(argc, argv);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Local<Value> err = NanError(error_msg("SCardGetStatusChange", ar->result).c_str());
|
|
|
|
Local<Value> err = Nan::Error(error_msg("SCardGetStatusChange", ar->result).c_str());
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
const unsigned argc = 1;
|
|
|
|
const unsigned argc = 1;
|
|
|
|
Handle<Value> argv[argc] = { err };
|
|
|
|
Local<Value> argv[argc] = { err };
|
|
|
|
NanCallback(NanNew(async_baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(async_baton->callback)).Call(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -442,30 +442,30 @@ void CardReader::DoConnect(uv_work_t* req) {
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::AfterConnect(uv_work_t* req, int status) {
|
|
|
|
void CardReader::AfterConnect(uv_work_t* req, int status) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
ConnectInput *ci = static_cast<ConnectInput*>(baton->input);
|
|
|
|
ConnectInput *ci = static_cast<ConnectInput*>(baton->input);
|
|
|
|
ConnectResult *cr = static_cast<ConnectResult*>(baton->result);
|
|
|
|
ConnectResult *cr = static_cast<ConnectResult*>(baton->result);
|
|
|
|
|
|
|
|
|
|
|
|
if (cr->result) {
|
|
|
|
if (cr->result) {
|
|
|
|
Local<Value> err = NanError(error_msg("SCardConnect", cr->result).c_str());
|
|
|
|
Local<Value> err = Nan::Error(error_msg("SCardConnect", cr->result).c_str());
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
const unsigned argc = 1;
|
|
|
|
const unsigned argc = 1;
|
|
|
|
Handle<Value> argv[argc] = { err };
|
|
|
|
Local<Value> argv[argc] = { err };
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
NanObjectWrapHandle(baton->reader)->Set(NanNew(connected_symbol), NanTrue());
|
|
|
|
baton->reader->handle()->Set(Nan::New(connected_symbol), Nan::True());
|
|
|
|
const unsigned argc = 2;
|
|
|
|
const unsigned argc = 2;
|
|
|
|
Handle<Value> argv[argc] = {
|
|
|
|
Local<Value> argv[argc] = {
|
|
|
|
NanNull(),
|
|
|
|
Nan::Null(),
|
|
|
|
NanNew<Number>(cr->card_protocol)
|
|
|
|
Nan::New<Number>(cr->card_protocol)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
NanDisposePersistent(baton->callback);
|
|
|
|
baton->callback.Reset();
|
|
|
|
delete ci;
|
|
|
|
delete ci;
|
|
|
|
delete cr;
|
|
|
|
delete cr;
|
|
|
|
delete baton;
|
|
|
|
delete baton;
|
|
|
|
@@ -497,29 +497,29 @@ void CardReader::DoDisconnect(uv_work_t* req) {
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::AfterDisconnect(uv_work_t* req, int status) {
|
|
|
|
void CardReader::AfterDisconnect(uv_work_t* req, int status) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
LONG* result = reinterpret_cast<LONG*>(baton->result);
|
|
|
|
LONG* result = reinterpret_cast<LONG*>(baton->result);
|
|
|
|
|
|
|
|
|
|
|
|
if (*result) {
|
|
|
|
if (*result) {
|
|
|
|
Local<Value> err = NanError(error_msg("SCardDisconnect", *result).c_str());
|
|
|
|
Local<Value> err = Nan::Error(error_msg("SCardDisconnect", *result).c_str());
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
const unsigned argc = 1;
|
|
|
|
const unsigned argc = 1;
|
|
|
|
Handle<Value> argv[argc] = { err };
|
|
|
|
Local<Value> argv[argc] = { err };
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
NanObjectWrapHandle(baton->reader)->Set(NanNew(connected_symbol), NanFalse());
|
|
|
|
baton->reader->handle()->Set(Nan::New(connected_symbol), Nan::False());
|
|
|
|
const unsigned argc = 1;
|
|
|
|
const unsigned argc = 1;
|
|
|
|
Handle<Value> argv[argc] = {
|
|
|
|
Local<Value> argv[argc] = {
|
|
|
|
NanNull()
|
|
|
|
Nan::Null()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
NanDisposePersistent(baton->callback);
|
|
|
|
baton->callback.Reset();
|
|
|
|
DWORD* disposition = reinterpret_cast<DWORD*>(baton->input);
|
|
|
|
DWORD* disposition = reinterpret_cast<DWORD*>(baton->input);
|
|
|
|
delete disposition;
|
|
|
|
delete disposition;
|
|
|
|
delete result;
|
|
|
|
delete result;
|
|
|
|
@@ -557,31 +557,31 @@ void CardReader::DoTransmit(uv_work_t* req) {
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::AfterTransmit(uv_work_t* req, int status) {
|
|
|
|
void CardReader::AfterTransmit(uv_work_t* req, int status) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
TransmitInput *ti = static_cast<TransmitInput*>(baton->input);
|
|
|
|
TransmitInput *ti = static_cast<TransmitInput*>(baton->input);
|
|
|
|
TransmitResult *tr = static_cast<TransmitResult*>(baton->result);
|
|
|
|
TransmitResult *tr = static_cast<TransmitResult*>(baton->result);
|
|
|
|
|
|
|
|
|
|
|
|
if (tr->result) {
|
|
|
|
if (tr->result) {
|
|
|
|
Local<Value> err = NanError(error_msg("SCardTransmit", tr->result).c_str());
|
|
|
|
Local<Value> err = Nan::Error(error_msg("SCardTransmit", tr->result).c_str());
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
const unsigned argc = 1;
|
|
|
|
const unsigned argc = 1;
|
|
|
|
Handle<Value> argv[argc] = { err };
|
|
|
|
Local<Value> argv[argc] = { err };
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const unsigned argc = 2;
|
|
|
|
const unsigned argc = 2;
|
|
|
|
Handle<Value> argv[argc] = {
|
|
|
|
Local<Value> argv[argc] = {
|
|
|
|
NanNull(),
|
|
|
|
Nan::Null(),
|
|
|
|
NanNewBufferHandle(reinterpret_cast<char*>(tr->data), tr->len)
|
|
|
|
Nan::NewBuffer(reinterpret_cast<char*>(tr->data), tr->len).ToLocalChecked()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
NanDisposePersistent(baton->callback);
|
|
|
|
baton->callback.Reset();
|
|
|
|
delete [] ti->in_data;
|
|
|
|
delete [] ti->in_data;
|
|
|
|
delete ti;
|
|
|
|
delete ti;
|
|
|
|
delete [] tr->data;
|
|
|
|
delete [] tr->data;
|
|
|
|
@@ -621,31 +621,31 @@ void CardReader::DoControl(uv_work_t* req) {
|
|
|
|
|
|
|
|
|
|
|
|
void CardReader::AfterControl(uv_work_t* req, int status) {
|
|
|
|
void CardReader::AfterControl(uv_work_t* req, int status) {
|
|
|
|
|
|
|
|
|
|
|
|
NanScope();
|
|
|
|
Nan::HandleScope scope;
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
Baton* baton = static_cast<Baton*>(req->data);
|
|
|
|
ControlInput *ci = static_cast<ControlInput*>(baton->input);
|
|
|
|
ControlInput *ci = static_cast<ControlInput*>(baton->input);
|
|
|
|
ControlResult *cr = static_cast<ControlResult*>(baton->result);
|
|
|
|
ControlResult *cr = static_cast<ControlResult*>(baton->result);
|
|
|
|
|
|
|
|
|
|
|
|
if (cr->result) {
|
|
|
|
if (cr->result) {
|
|
|
|
Local<Value> err = NanError(error_msg("SCardControl", cr->result).c_str());
|
|
|
|
Local<Value> err = Nan::Error(error_msg("SCardControl", cr->result).c_str());
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
// Prepare the parameters for the callback function.
|
|
|
|
const unsigned argc = 1;
|
|
|
|
const unsigned argc = 1;
|
|
|
|
Handle<Value> argv[argc] = { err };
|
|
|
|
Local<Value> argv[argc] = { err };
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const unsigned argc = 2;
|
|
|
|
const unsigned argc = 2;
|
|
|
|
Handle<Value> argv[argc] = {
|
|
|
|
Local<Value> argv[argc] = {
|
|
|
|
NanNull(),
|
|
|
|
Nan::Null(),
|
|
|
|
NanNew<Number>(cr->len)
|
|
|
|
Nan::New<Number>(cr->len)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NanCallback(NanNew(baton->callback)).Call(argc, argv);
|
|
|
|
Nan::Callback(Nan::New(baton->callback)).Call(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
// The callback is a permanent handle, so we have to dispose of it manually.
|
|
|
|
NanDisposePersistent(baton->callback);
|
|
|
|
baton->callback.Reset();
|
|
|
|
delete ci;
|
|
|
|
delete ci;
|
|
|
|
delete cr;
|
|
|
|
delete cr;
|
|
|
|
delete baton;
|
|
|
|
delete baton;
|
|
|
|
@@ -657,7 +657,7 @@ void CardReader::CloseCallback(uv_handle_t *handle) {
|
|
|
|
AsyncBaton* async_baton = static_cast<AsyncBaton*>(handle->data);
|
|
|
|
AsyncBaton* async_baton = static_cast<AsyncBaton*>(handle->data);
|
|
|
|
AsyncResult* ar = async_baton->async_result;
|
|
|
|
AsyncResult* ar = async_baton->async_result;
|
|
|
|
delete ar;
|
|
|
|
delete ar;
|
|
|
|
NanDisposePersistent(async_baton->callback);
|
|
|
|
async_baton->callback.Reset();
|
|
|
|
SCardReleaseContext(async_baton->reader->m_status_card_context);
|
|
|
|
SCardReleaseContext(async_baton->reader->m_status_card_context);
|
|
|
|
delete async_baton;
|
|
|
|
delete async_baton;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|