Skip to main content

cdp_driver/protocol/
smart_card_emulation.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! The `SmartCardEmulation` domain.
5//!
6//! Types, command parameters and event payloads for the `SmartCardEmulation`
7//! domain. The method-name constants for the same domain are in
8//! [`crate::methods`].
9//!
10//! This domain is experimental and may change without notice.
11
12use serde::{Deserialize, Serialize};
13
14/// Indicates the PC/SC error code. This maps to: PC/SC Lite:
15/// <https://pcsclite.apdu.fr/api/group__ErrorCodes.html> Microsoft:
16/// <https://learn.microsoft.com/en-us/windows/win32/secauthn/authentication-return-values>
17#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
18pub enum ResultCode {
19    /// `success`
20    #[serde(rename = "success")]
21    Success,
22    /// `removed-card`
23    #[serde(rename = "removed-card")]
24    RemovedCard,
25    /// `reset-card`
26    #[serde(rename = "reset-card")]
27    ResetCard,
28    /// `unpowered-card`
29    #[serde(rename = "unpowered-card")]
30    UnpoweredCard,
31    /// `unresponsive-card`
32    #[serde(rename = "unresponsive-card")]
33    UnresponsiveCard,
34    /// `unsupported-card`
35    #[serde(rename = "unsupported-card")]
36    UnsupportedCard,
37    /// `reader-unavailable`
38    #[serde(rename = "reader-unavailable")]
39    ReaderUnavailable,
40    /// `sharing-violation`
41    #[serde(rename = "sharing-violation")]
42    SharingViolation,
43    /// `not-transacted`
44    #[serde(rename = "not-transacted")]
45    NotTransacted,
46    /// `no-smartcard`
47    #[serde(rename = "no-smartcard")]
48    NoSmartcard,
49    /// `proto-mismatch`
50    #[serde(rename = "proto-mismatch")]
51    ProtoMismatch,
52    /// `system-cancelled`
53    #[serde(rename = "system-cancelled")]
54    SystemCancelled,
55    /// `not-ready`
56    #[serde(rename = "not-ready")]
57    NotReady,
58    /// `cancelled`
59    #[serde(rename = "cancelled")]
60    Cancelled,
61    /// `insufficient-buffer`
62    #[serde(rename = "insufficient-buffer")]
63    InsufficientBuffer,
64    /// `invalid-handle`
65    #[serde(rename = "invalid-handle")]
66    InvalidHandle,
67    /// `invalid-parameter`
68    #[serde(rename = "invalid-parameter")]
69    InvalidParameter,
70    /// `invalid-value`
71    #[serde(rename = "invalid-value")]
72    InvalidValue,
73    /// `no-memory`
74    #[serde(rename = "no-memory")]
75    NoMemory,
76    /// `timeout`
77    #[serde(rename = "timeout")]
78    Timeout,
79    /// `unknown-reader`
80    #[serde(rename = "unknown-reader")]
81    UnknownReader,
82    /// `unsupported-feature`
83    #[serde(rename = "unsupported-feature")]
84    UnsupportedFeature,
85    /// `no-readers-available`
86    #[serde(rename = "no-readers-available")]
87    NoReadersAvailable,
88    /// `service-stopped`
89    #[serde(rename = "service-stopped")]
90    ServiceStopped,
91    /// `no-service`
92    #[serde(rename = "no-service")]
93    NoService,
94    /// `comm-error`
95    #[serde(rename = "comm-error")]
96    CommError,
97    /// `internal-error`
98    #[serde(rename = "internal-error")]
99    InternalError,
100    /// `server-too-busy`
101    #[serde(rename = "server-too-busy")]
102    ServerTooBusy,
103    /// `unexpected`
104    #[serde(rename = "unexpected")]
105    Unexpected,
106    /// `shutdown`
107    #[serde(rename = "shutdown")]
108    Shutdown,
109    /// `unknown-card`
110    #[serde(rename = "unknown-card")]
111    UnknownCard,
112    /// `unknown`
113    #[serde(rename = "unknown")]
114    Unknown,
115    /// A value this vendored schema does not list. Chrome adds values ahead of
116    /// the published protocol, so an unrecognised one is kept as it arrived
117    /// rather than failing the payload it came in.
118    #[serde(untagged)]
119    Unrecognized(String),
120}
121
122/// Maps to the |SCARD_SHARE_*| values.
123#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
124pub enum ShareMode {
125    /// `shared`
126    #[serde(rename = "shared")]
127    Shared,
128    /// `exclusive`
129    #[serde(rename = "exclusive")]
130    Exclusive,
131    /// `direct`
132    #[serde(rename = "direct")]
133    Direct,
134    /// A value this vendored schema does not list. Chrome adds values ahead of
135    /// the published protocol, so an unrecognised one is kept as it arrived
136    /// rather than failing the payload it came in.
137    #[serde(untagged)]
138    Unrecognized(String),
139}
140
141/// Indicates what the reader should do with the card.
142#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
143pub enum Disposition {
144    /// `leave-card`
145    #[serde(rename = "leave-card")]
146    LeaveCard,
147    /// `reset-card`
148    #[serde(rename = "reset-card")]
149    ResetCard,
150    /// `unpower-card`
151    #[serde(rename = "unpower-card")]
152    UnpowerCard,
153    /// `eject-card`
154    #[serde(rename = "eject-card")]
155    EjectCard,
156    /// A value this vendored schema does not list. Chrome adds values ahead of
157    /// the published protocol, so an unrecognised one is kept as it arrived
158    /// rather than failing the payload it came in.
159    #[serde(untagged)]
160    Unrecognized(String),
161}
162
163/// Maps to |SCARD_*| connection state values.
164#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
165pub enum ConnectionState {
166    /// `absent`
167    #[serde(rename = "absent")]
168    Absent,
169    /// `present`
170    #[serde(rename = "present")]
171    Present,
172    /// `swallowed`
173    #[serde(rename = "swallowed")]
174    Swallowed,
175    /// `powered`
176    #[serde(rename = "powered")]
177    Powered,
178    /// `negotiable`
179    #[serde(rename = "negotiable")]
180    Negotiable,
181    /// `specific`
182    #[serde(rename = "specific")]
183    Specific,
184    /// A value this vendored schema does not list. Chrome adds values ahead of
185    /// the published protocol, so an unrecognised one is kept as it arrived
186    /// rather than failing the payload it came in.
187    #[serde(untagged)]
188    Unrecognized(String),
189}
190
191/// Maps to the |SCARD_STATE_*| flags.
192#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
193pub struct ReaderStateFlags {
194    #[serde(default, skip_serializing_if = "Option::is_none")]
195    pub unaware: Option<bool>,
196    #[serde(default, skip_serializing_if = "Option::is_none")]
197    pub ignore: Option<bool>,
198    #[serde(default, skip_serializing_if = "Option::is_none")]
199    pub changed: Option<bool>,
200    #[serde(default, skip_serializing_if = "Option::is_none")]
201    pub unknown: Option<bool>,
202    #[serde(default, skip_serializing_if = "Option::is_none")]
203    pub unavailable: Option<bool>,
204    #[serde(default, skip_serializing_if = "Option::is_none")]
205    pub empty: Option<bool>,
206    #[serde(default, skip_serializing_if = "Option::is_none")]
207    pub present: Option<bool>,
208    #[serde(default, skip_serializing_if = "Option::is_none")]
209    pub exclusive: Option<bool>,
210    #[serde(default, skip_serializing_if = "Option::is_none")]
211    pub inuse: Option<bool>,
212    #[serde(default, skip_serializing_if = "Option::is_none")]
213    pub mute: Option<bool>,
214    #[serde(default, skip_serializing_if = "Option::is_none")]
215    pub unpowered: Option<bool>,
216}
217
218/// Maps to the |SCARD_PROTOCOL_*| flags.
219#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
220pub struct ProtocolSet {
221    #[serde(default, skip_serializing_if = "Option::is_none")]
222    pub t0: Option<bool>,
223    #[serde(default, skip_serializing_if = "Option::is_none")]
224    pub t1: Option<bool>,
225    #[serde(default, skip_serializing_if = "Option::is_none")]
226    pub raw: Option<bool>,
227}
228
229/// Maps to the |SCARD_PROTOCOL_*| values.
230#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
231pub enum Protocol {
232    /// `t0`
233    #[serde(rename = "t0")]
234    T0,
235    /// `t1`
236    #[serde(rename = "t1")]
237    T1,
238    /// `raw`
239    #[serde(rename = "raw")]
240    Raw,
241    /// A value this vendored schema does not list. Chrome adds values ahead of
242    /// the published protocol, so an unrecognised one is kept as it arrived
243    /// rather than failing the payload it came in.
244    #[serde(untagged)]
245    Unrecognized(String),
246}
247
248#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
249pub struct ReaderStateIn {
250    pub reader: String,
251    #[serde(rename = "currentState")]
252    pub current_state: ReaderStateFlags,
253    #[serde(rename = "currentInsertionCount")]
254    pub current_insertion_count: i64,
255}
256
257#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
258pub struct ReaderStateOut {
259    pub reader: String,
260    #[serde(rename = "eventState")]
261    pub event_state: ReaderStateFlags,
262    #[serde(rename = "eventCount")]
263    pub event_count: i64,
264    pub atr: String,
265}
266
267/// Enables the |SmartCardEmulation| domain.
268///
269/// Parameters of `SmartCardEmulation.enable`.
270#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
271pub struct EnableParams {}
272
273impl crate::typed::Command for EnableParams {
274    const METHOD: &'static str = "SmartCardEmulation.enable";
275    type Returns = crate::typed::NoReturns;
276}
277
278/// Disables the |SmartCardEmulation| domain.
279///
280/// Parameters of `SmartCardEmulation.disable`.
281#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
282pub struct DisableParams {}
283
284impl crate::typed::Command for DisableParams {
285    const METHOD: &'static str = "SmartCardEmulation.disable";
286    type Returns = crate::typed::NoReturns;
287}
288
289/// Reports the successful result of a |SCardEstablishContext| call. This maps
290/// to: PC/SC Lite:
291/// <https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67>
292/// Microsoft:
293/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext>
294///
295/// Parameters of `SmartCardEmulation.reportEstablishContextResult`.
296#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
297pub struct ReportEstablishContextResultParams {
298    #[serde(rename = "requestId")]
299    pub request_id: String,
300    #[serde(rename = "contextId")]
301    pub context_id: i64,
302}
303
304impl crate::typed::Command for ReportEstablishContextResultParams {
305    const METHOD: &'static str = "SmartCardEmulation.reportEstablishContextResult";
306    type Returns = crate::typed::NoReturns;
307}
308
309/// Reports the successful result of a |SCardReleaseContext| call. This maps
310/// to: PC/SC Lite:
311/// <https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934>
312/// Microsoft:
313/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext>
314///
315/// Parameters of `SmartCardEmulation.reportReleaseContextResult`.
316#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
317pub struct ReportReleaseContextResultParams {
318    #[serde(rename = "requestId")]
319    pub request_id: String,
320}
321
322impl crate::typed::Command for ReportReleaseContextResultParams {
323    const METHOD: &'static str = "SmartCardEmulation.reportReleaseContextResult";
324    type Returns = crate::typed::NoReturns;
325}
326
327/// Reports the successful result of a |SCardListReaders| call. This maps to:
328/// PC/SC Lite:
329/// <https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9>
330/// Microsoft:
331/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa>
332///
333/// Parameters of `SmartCardEmulation.reportListReadersResult`.
334#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
335pub struct ReportListReadersResultParams {
336    #[serde(rename = "requestId")]
337    pub request_id: String,
338    pub readers: Vec<String>,
339}
340
341impl crate::typed::Command for ReportListReadersResultParams {
342    const METHOD: &'static str = "SmartCardEmulation.reportListReadersResult";
343    type Returns = crate::typed::NoReturns;
344}
345
346/// Reports the successful result of a |SCardGetStatusChange| call. This maps
347/// to: PC/SC Lite:
348/// <https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24>
349/// Microsoft:
350/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea>
351///
352/// Parameters of `SmartCardEmulation.reportGetStatusChangeResult`.
353#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
354pub struct ReportGetStatusChangeResultParams {
355    #[serde(rename = "requestId")]
356    pub request_id: String,
357    #[serde(rename = "readerStates")]
358    pub reader_states: Vec<ReaderStateOut>,
359}
360
361impl crate::typed::Command for ReportGetStatusChangeResultParams {
362    const METHOD: &'static str = "SmartCardEmulation.reportGetStatusChangeResult";
363    type Returns = crate::typed::NoReturns;
364}
365
366/// Reports the result of a |SCardBeginTransaction| call. On success, this
367/// creates a new transaction object. This maps to: PC/SC Lite:
368/// <https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861>
369/// Microsoft:
370/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction>
371///
372/// Parameters of `SmartCardEmulation.reportBeginTransactionResult`.
373#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
374pub struct ReportBeginTransactionResultParams {
375    #[serde(rename = "requestId")]
376    pub request_id: String,
377    pub handle: i64,
378}
379
380impl crate::typed::Command for ReportBeginTransactionResultParams {
381    const METHOD: &'static str = "SmartCardEmulation.reportBeginTransactionResult";
382    type Returns = crate::typed::NoReturns;
383}
384
385/// Reports the successful result of a call that returns only a result code.
386/// Used for: |SCardCancel|, |SCardDisconnect|, |SCardSetAttrib|,
387/// |SCardEndTransaction|. This maps to: 1. SCardCancel PC/SC Lite:
388/// <https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6>
389/// Microsoft:
390/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel>
391/// 2. SCardDisconnect PC/SC Lite:
392/// <https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a>
393/// Microsoft:
394/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect>
395/// 3. SCardSetAttrib PC/SC Lite:
396/// <https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f>
397/// Microsoft:
398/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib>
399/// 4. SCardEndTransaction PC/SC Lite:
400/// <https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b>
401/// Microsoft:
402/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction>
403///
404/// Parameters of `SmartCardEmulation.reportPlainResult`.
405#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
406pub struct ReportPlainResultParams {
407    #[serde(rename = "requestId")]
408    pub request_id: String,
409}
410
411impl crate::typed::Command for ReportPlainResultParams {
412    const METHOD: &'static str = "SmartCardEmulation.reportPlainResult";
413    type Returns = crate::typed::NoReturns;
414}
415
416/// Reports the successful result of a |SCardConnect| call. This maps to:
417/// PC/SC Lite:
418/// <https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5>
419/// Microsoft:
420/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta>
421///
422/// Parameters of `SmartCardEmulation.reportConnectResult`.
423#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
424pub struct ReportConnectResultParams {
425    #[serde(rename = "requestId")]
426    pub request_id: String,
427    pub handle: i64,
428    #[serde(
429        rename = "activeProtocol",
430        default,
431        skip_serializing_if = "Option::is_none"
432    )]
433    pub active_protocol: Option<Protocol>,
434}
435
436impl crate::typed::Command for ReportConnectResultParams {
437    const METHOD: &'static str = "SmartCardEmulation.reportConnectResult";
438    type Returns = crate::typed::NoReturns;
439}
440
441/// Reports the successful result of a call that sends back data on success.
442/// Used for |SCardTransmit|, |SCardControl|, and |SCardGetAttrib|. This maps
443/// to: 1. SCardTransmit PC/SC Lite:
444/// <https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99>
445/// Microsoft:
446/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit>
447/// 2. SCardControl PC/SC Lite:
448/// <https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f>
449/// Microsoft:
450/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol>
451/// 3. SCardGetAttrib PC/SC Lite:
452/// <https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602>
453/// Microsoft:
454/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib>
455///
456/// Parameters of `SmartCardEmulation.reportDataResult`.
457#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
458pub struct ReportDataResultParams {
459    #[serde(rename = "requestId")]
460    pub request_id: String,
461    pub data: String,
462}
463
464impl crate::typed::Command for ReportDataResultParams {
465    const METHOD: &'static str = "SmartCardEmulation.reportDataResult";
466    type Returns = crate::typed::NoReturns;
467}
468
469/// Reports the successful result of a |SCardStatus| call. This maps to: PC/SC
470/// Lite:
471/// <https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382>
472/// Microsoft:
473/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa>
474///
475/// Parameters of `SmartCardEmulation.reportStatusResult`.
476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
477pub struct ReportStatusResultParams {
478    #[serde(rename = "requestId")]
479    pub request_id: String,
480    #[serde(rename = "readerName")]
481    pub reader_name: String,
482    pub state: ConnectionState,
483    pub atr: String,
484    #[serde(default, skip_serializing_if = "Option::is_none")]
485    pub protocol: Option<Protocol>,
486}
487
488impl crate::typed::Command for ReportStatusResultParams {
489    const METHOD: &'static str = "SmartCardEmulation.reportStatusResult";
490    type Returns = crate::typed::NoReturns;
491}
492
493/// Reports an error result for the given request.
494///
495/// Parameters of `SmartCardEmulation.reportError`.
496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
497pub struct ReportErrorParams {
498    #[serde(rename = "requestId")]
499    pub request_id: String,
500    #[serde(rename = "resultCode")]
501    pub result_code: ResultCode,
502}
503
504impl crate::typed::Command for ReportErrorParams {
505    const METHOD: &'static str = "SmartCardEmulation.reportError";
506    type Returns = crate::typed::NoReturns;
507}
508
509/// Fired when |SCardEstablishContext| is called. This maps to: PC/SC Lite:
510/// <https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67>
511/// Microsoft:
512/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext>
513///
514/// Payload of the `SmartCardEmulation.establishContextRequested` event.
515#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
516pub struct EstablishContextRequestedEvent {
517    #[serde(rename = "requestId")]
518    pub request_id: String,
519}
520
521impl crate::typed::Event for EstablishContextRequestedEvent {
522    const METHOD: &'static str = "SmartCardEmulation.establishContextRequested";
523}
524
525/// Fired when |SCardReleaseContext| is called. This maps to: PC/SC Lite:
526/// <https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934>
527/// Microsoft:
528/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext>
529///
530/// Payload of the `SmartCardEmulation.releaseContextRequested` event.
531#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
532pub struct ReleaseContextRequestedEvent {
533    #[serde(rename = "requestId")]
534    pub request_id: String,
535    #[serde(rename = "contextId")]
536    pub context_id: i64,
537}
538
539impl crate::typed::Event for ReleaseContextRequestedEvent {
540    const METHOD: &'static str = "SmartCardEmulation.releaseContextRequested";
541}
542
543/// Fired when |SCardListReaders| is called. This maps to: PC/SC Lite:
544/// <https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9>
545/// Microsoft:
546/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa>
547///
548/// Payload of the `SmartCardEmulation.listReadersRequested` event.
549#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
550pub struct ListReadersRequestedEvent {
551    #[serde(rename = "requestId")]
552    pub request_id: String,
553    #[serde(rename = "contextId")]
554    pub context_id: i64,
555}
556
557impl crate::typed::Event for ListReadersRequestedEvent {
558    const METHOD: &'static str = "SmartCardEmulation.listReadersRequested";
559}
560
561/// Fired when |SCardGetStatusChange| is called. Timeout is specified in
562/// milliseconds. This maps to: PC/SC Lite:
563/// <https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24>
564/// Microsoft:
565/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea>
566///
567/// Payload of the `SmartCardEmulation.getStatusChangeRequested` event.
568#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
569pub struct GetStatusChangeRequestedEvent {
570    #[serde(rename = "requestId")]
571    pub request_id: String,
572    #[serde(rename = "contextId")]
573    pub context_id: i64,
574    #[serde(rename = "readerStates")]
575    pub reader_states: Vec<ReaderStateIn>,
576    /// in milliseconds, if absent, it means "infinite"
577    #[serde(default, skip_serializing_if = "Option::is_none")]
578    pub timeout: Option<i64>,
579}
580
581impl crate::typed::Event for GetStatusChangeRequestedEvent {
582    const METHOD: &'static str = "SmartCardEmulation.getStatusChangeRequested";
583}
584
585/// Fired when |SCardCancel| is called. This maps to: PC/SC Lite:
586/// <https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6>
587/// Microsoft:
588/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel>
589///
590/// Payload of the `SmartCardEmulation.cancelRequested` event.
591#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
592pub struct CancelRequestedEvent {
593    #[serde(rename = "requestId")]
594    pub request_id: String,
595    #[serde(rename = "contextId")]
596    pub context_id: i64,
597}
598
599impl crate::typed::Event for CancelRequestedEvent {
600    const METHOD: &'static str = "SmartCardEmulation.cancelRequested";
601}
602
603/// Fired when |SCardConnect| is called. This maps to: PC/SC Lite:
604/// <https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5>
605/// Microsoft:
606/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta>
607///
608/// Payload of the `SmartCardEmulation.connectRequested` event.
609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
610pub struct ConnectRequestedEvent {
611    #[serde(rename = "requestId")]
612    pub request_id: String,
613    #[serde(rename = "contextId")]
614    pub context_id: i64,
615    pub reader: String,
616    #[serde(rename = "shareMode")]
617    pub share_mode: ShareMode,
618    #[serde(rename = "preferredProtocols")]
619    pub preferred_protocols: ProtocolSet,
620}
621
622impl crate::typed::Event for ConnectRequestedEvent {
623    const METHOD: &'static str = "SmartCardEmulation.connectRequested";
624}
625
626/// Fired when |SCardDisconnect| is called. This maps to: PC/SC Lite:
627/// <https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a>
628/// Microsoft:
629/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect>
630///
631/// Payload of the `SmartCardEmulation.disconnectRequested` event.
632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
633pub struct DisconnectRequestedEvent {
634    #[serde(rename = "requestId")]
635    pub request_id: String,
636    pub handle: i64,
637    pub disposition: Disposition,
638}
639
640impl crate::typed::Event for DisconnectRequestedEvent {
641    const METHOD: &'static str = "SmartCardEmulation.disconnectRequested";
642}
643
644/// Fired when |SCardTransmit| is called. This maps to: PC/SC Lite:
645/// <https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99>
646/// Microsoft:
647/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit>
648///
649/// Payload of the `SmartCardEmulation.transmitRequested` event.
650#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
651pub struct TransmitRequestedEvent {
652    #[serde(rename = "requestId")]
653    pub request_id: String,
654    pub handle: i64,
655    pub data: String,
656    #[serde(default, skip_serializing_if = "Option::is_none")]
657    pub protocol: Option<Protocol>,
658}
659
660impl crate::typed::Event for TransmitRequestedEvent {
661    const METHOD: &'static str = "SmartCardEmulation.transmitRequested";
662}
663
664/// Fired when |SCardControl| is called. This maps to: PC/SC Lite:
665/// <https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f>
666/// Microsoft:
667/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol>
668///
669/// Payload of the `SmartCardEmulation.controlRequested` event.
670#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
671pub struct ControlRequestedEvent {
672    #[serde(rename = "requestId")]
673    pub request_id: String,
674    pub handle: i64,
675    #[serde(rename = "controlCode")]
676    pub control_code: i64,
677    pub data: String,
678}
679
680impl crate::typed::Event for ControlRequestedEvent {
681    const METHOD: &'static str = "SmartCardEmulation.controlRequested";
682}
683
684/// Fired when |SCardGetAttrib| is called. This maps to: PC/SC Lite:
685/// <https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602>
686/// Microsoft:
687/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib>
688///
689/// Payload of the `SmartCardEmulation.getAttribRequested` event.
690#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
691pub struct GetAttribRequestedEvent {
692    #[serde(rename = "requestId")]
693    pub request_id: String,
694    pub handle: i64,
695    #[serde(rename = "attribId")]
696    pub attrib_id: i64,
697}
698
699impl crate::typed::Event for GetAttribRequestedEvent {
700    const METHOD: &'static str = "SmartCardEmulation.getAttribRequested";
701}
702
703/// Fired when |SCardSetAttrib| is called. This maps to: PC/SC Lite:
704/// <https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f>
705/// Microsoft:
706/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib>
707///
708/// Payload of the `SmartCardEmulation.setAttribRequested` event.
709#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
710pub struct SetAttribRequestedEvent {
711    #[serde(rename = "requestId")]
712    pub request_id: String,
713    pub handle: i64,
714    #[serde(rename = "attribId")]
715    pub attrib_id: i64,
716    pub data: String,
717}
718
719impl crate::typed::Event for SetAttribRequestedEvent {
720    const METHOD: &'static str = "SmartCardEmulation.setAttribRequested";
721}
722
723/// Fired when |SCardStatus| is called. This maps to: PC/SC Lite:
724/// <https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382>
725/// Microsoft:
726/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa>
727///
728/// Payload of the `SmartCardEmulation.statusRequested` event.
729#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
730pub struct StatusRequestedEvent {
731    #[serde(rename = "requestId")]
732    pub request_id: String,
733    pub handle: i64,
734}
735
736impl crate::typed::Event for StatusRequestedEvent {
737    const METHOD: &'static str = "SmartCardEmulation.statusRequested";
738}
739
740/// Fired when |SCardBeginTransaction| is called. This maps to: PC/SC Lite:
741/// <https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861>
742/// Microsoft:
743/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction>
744///
745/// Payload of the `SmartCardEmulation.beginTransactionRequested` event.
746#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
747pub struct BeginTransactionRequestedEvent {
748    #[serde(rename = "requestId")]
749    pub request_id: String,
750    pub handle: i64,
751}
752
753impl crate::typed::Event for BeginTransactionRequestedEvent {
754    const METHOD: &'static str = "SmartCardEmulation.beginTransactionRequested";
755}
756
757/// Fired when |SCardEndTransaction| is called. This maps to: PC/SC Lite:
758/// <https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b>
759/// Microsoft:
760/// <https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction>
761///
762/// Payload of the `SmartCardEmulation.endTransactionRequested` event.
763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
764pub struct EndTransactionRequestedEvent {
765    #[serde(rename = "requestId")]
766    pub request_id: String,
767    pub handle: i64,
768    pub disposition: Disposition,
769}
770
771impl crate::typed::Event for EndTransactionRequestedEvent {
772    const METHOD: &'static str = "SmartCardEmulation.endTransactionRequested";
773}