-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.go
45 lines (38 loc) · 1.39 KB
/
device.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package gonfc
import (
"time"
"go.uber.org/zap"
)
type Device interface {
ID() DeviceID
Close() error
String() string
SetPropertyBool(property Property, value bool) error
SetPropertyInt(property Property, value int) error
SetPropertyDuration(property Property, value time.Duration) error
InitiatorInit() error
// InitiatorInitSecureElement() error
InitiatorSelectPassiveTarget(m Modulation, initData []byte) (*NfcTarget, error)
InitiatorPollTarget(modulations []Modulation, pollnr byte, period byte) (*NfcTarget, error)
// InitiatorSelectDepTarget(ndm DepMode, nbr BaudRate, pndiInitiator *DepInfo, timeout time.Duration) (*NfcTarget, error)
InitiatorDeselectTarget() error
InitiatorTransceiveBytes(tx, rx []byte, timeout time.Duration) (int, error)
InitiatorTransceiveBits(tx []byte, txBits int, txPar []byte, rx []byte, rxPar []byte) (int, error)
// InitiatorTransceiveBytesTimed()
// InitiatorTransceiveBitsTimed()
InitiatorTargetIsPresent(nt *NfcTarget) (bool, error)
//WIP
SetLastError(err error)
GetInfiniteSelect() bool
Logger() *zap.SugaredLogger
DeviceGetSupportedModulation(mode Mode) ([]ModulationType, error)
GetSupportedBaudRate(nmt ModulationType) ([]BaudRate, error)
GetSupportedBaudRateTargetMode(nmt ModulationType) ([]BaudRate, error)
}
type NFCDeviceCommon struct {
LastError error
InfiniteSelect bool
Par bool
EasyFraming bool
AbortFlag bool
}