Documentation
¶
Overview ¶
Package threadnetwork provides a fluent Go API over the macOS ThreadNetwork framework.
Index ¶
- type THClient
- func (x *THClient) CheckPreferredNetworkForActiveOperationalDatasetCompletion(activeOperationalDataSet *foundation.NSData, completion func(bool))
- func (x *THClient) DeleteCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) error
- func (x *THClient) ID() objc.ID
- func (x *THClient) IsPreferredNetworkAvailableWithCompletion(completion func(bool))
- func (x *THClient) RetrieveAllActiveCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
- func (x *THClient) RetrieveAllCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
- func (x *THClient) RetrieveCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) (*THCredentials, error)
- func (x *THClient) RetrieveCredentialsForExtendedPANIDCompletion(ctx context.Context, extendedPANID *foundation.NSData) (*THCredentials, error)
- func (x *THClient) RetrievePreferredCredentials(ctx context.Context) (*THCredentials, error)
- func (x *THClient) StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion(ctx context.Context, borderAgentID *foundation.NSData, ...) error
- func (x *THClient) Unwrap() *raw.THClient
- type THClientable
- type THCredentials
- func (x *THCredentials) ActiveOperationalDataSet() *foundation.NSData
- func (x *THCredentials) BorderAgentID() *foundation.NSData
- func (x *THCredentials) Channel() uint8
- func (x *THCredentials) CreationDate() *foundation.NSDate
- func (x *THCredentials) ExtendedPANID() *foundation.NSData
- func (x *THCredentials) ID() objc.ID
- func (x *THCredentials) LastModificationDate() *foundation.NSDate
- func (x *THCredentials) NetworkKey() *foundation.NSData
- func (x *THCredentials) NetworkName() string
- func (x *THCredentials) PSKC() *foundation.NSData
- func (x *THCredentials) PanID() *foundation.NSData
- func (x *THCredentials) SetChannel(channel uint8)
- func (x *THCredentials) Unwrap() *raw.THCredentials
- func (x *THCredentials) WithChannel(channel uint8) *THCredentials
- type THCredentialsable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type THClient ¶
type THClient struct {
// contains filtered or unexported fields
}
A class that supports safely sharing Thread credentials between multiple clients.
THClient wraps raw.THClient with a fluent Go API.
func THClientFromID ¶
THClientFromID adopts an existing object pointer as a THClient (nil for 0).
func (*THClient) CheckPreferredNetworkForActiveOperationalDatasetCompletion ¶
func (x *THClient) CheckPreferredNetworkForActiveOperationalDatasetCompletion(activeOperationalDataSet *foundation.NSData, completion func(bool))
Determines if the essential operating parameters match the preferred network’s parameters.
CheckPreferredNetworkForActiveOperationalDatasetCompletion calls the underlying CheckPreferredNetworkForActiveOperationalDatasetCompletion.
func (*THClient) DeleteCredentialsForBorderAgentCompletion ¶
func (x *THClient) DeleteCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) error
Deletes Thread network credentials from the framework database for a Border Agent.
DeleteCredentialsForBorderAgentCompletion blocks until the operation completes or ctx is cancelled.
func (*THClient) ID ¶
ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.
func (*THClient) IsPreferredNetworkAvailableWithCompletion ¶
Indicates whether a preferred network is available.
IsPreferredNetworkAvailableWithCompletion calls the underlying IsPreferredNetworkAvailableWithCompletion.
func (*THClient) RetrieveAllActiveCredentials ¶
func (x *THClient) RetrieveAllActiveCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
Returns a set of the active credentials.
RetrieveAllActiveCredentials blocks until the operation completes or ctx is cancelled.
func (*THClient) RetrieveAllCredentials ¶
func (x *THClient) RetrieveAllCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
Requests all Thread credentials from the framework.
RetrieveAllCredentials blocks until the operation completes or ctx is cancelled.
func (*THClient) RetrieveCredentialsForBorderAgentCompletion ¶
func (x *THClient) RetrieveCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) (*THCredentials, error)
Requests Thread credentials for a Border Agent.
RetrieveCredentialsForBorderAgentCompletion blocks until the operation completes or ctx is cancelled.
func (*THClient) RetrieveCredentialsForExtendedPANIDCompletion ¶
func (x *THClient) RetrieveCredentialsForExtendedPANIDCompletion(ctx context.Context, extendedPANID *foundation.NSData) (*THCredentials, error)
Requests Thread credentials for an extended Personal Area Network (PAN) ID.
RetrieveCredentialsForExtendedPANIDCompletion blocks until the operation completes or ctx is cancelled.
func (*THClient) RetrievePreferredCredentials ¶
func (x *THClient) RetrievePreferredCredentials(ctx context.Context) (*THCredentials, error)
Requests Thread credentials for the preferred network.
RetrievePreferredCredentials blocks until the operation completes or ctx is cancelled.
func (*THClient) StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion ¶
func (x *THClient) StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion(ctx context.Context, borderAgentID *foundation.NSData, activeOperationalDataSet *foundation.NSData) error
Stores Thread network credentials into the framework database that a Border Agent provides.
StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion blocks until the operation completes or ctx is cancelled.
type THClientable ¶
type THClientable interface {
Unwrap() *raw.THClient
RetrieveAllCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
RetrieveAllActiveCredentials(ctx context.Context) (*foundation.NSSet[*raw.THCredentials], error)
DeleteCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) error
RetrieveCredentialsForBorderAgentCompletion(ctx context.Context, borderAgentID *foundation.NSData) (*THCredentials, error)
StoreCredentialsForBorderAgentActiveOperationalDataSetCompletion(ctx context.Context, borderAgentID *foundation.NSData, activeOperationalDataSet *foundation.NSData) error
RetrievePreferredCredentials(ctx context.Context) (*THCredentials, error)
RetrieveCredentialsForExtendedPANIDCompletion(ctx context.Context, extendedPANID *foundation.NSData) (*THCredentials, error)
CheckPreferredNetworkForActiveOperationalDatasetCompletion(activeOperationalDataSet *foundation.NSData, completion func(bool))
IsPreferredNetworkAvailableWithCompletion(completion func(bool))
}
THClientable is the interface implemented by THClient, for mocking and DI.
type THCredentials ¶
type THCredentials struct {
// contains filtered or unexported fields
}
A class that contains credentials for a Thread network.
THCredentials wraps raw.THCredentials with a fluent Go API.
func NewTHCredentials ¶
func NewTHCredentials() *THCredentials
NewTHCredentials creates a new THCredentials.
func THCredentialsFromID ¶
func THCredentialsFromID(id objc.ID) *THCredentials
THCredentialsFromID adopts an existing object pointer as a THCredentials (nil for 0).
func (*THCredentials) ActiveOperationalDataSet ¶
func (x *THCredentials) ActiveOperationalDataSet() *foundation.NSData
The essential operational parameters for the Thread network. The framework parses this property, then extracts and sets “THCredentials/channel“, “THCredentials/extendedPANID“, “THCredentials/networkKey“, “THCredentials/networkName“, “THCredentials/panID“, and “THCredentials/PSKC“ when you call “THClient/storeCredentialsForBorderAgent:activeOperationalDataSet:completion:“.
ActiveOperationalDataSet calls the underlying ActiveOperationalDataSet.
func (*THCredentials) BorderAgentID ¶
func (x *THCredentials) BorderAgentID() *foundation.NSData
The identifer of an active Thread network Border Agent. This property’s value is the MAC Extended Address, a random identifier that the active Thread network border router generates.
BorderAgentID calls the underlying BorderAgentID.
func (*THCredentials) Channel ¶
func (x *THCredentials) Channel() uint8
The Thread network radio channel.
Channel calls the underlying Channel.
func (*THCredentials) CreationDate ¶
func (x *THCredentials) CreationDate() *foundation.NSDate
The date and time that the framework stored the credential in the database.
CreationDate calls the underlying CreationDate.
func (*THCredentials) ExtendedPANID ¶
func (x *THCredentials) ExtendedPANID() *foundation.NSData
The Thread network extended PAN identifier.
ExtendedPANID calls the underlying ExtendedPANID.
func (*THCredentials) ID ¶
func (x *THCredentials) ID() objc.ID
ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.
func (*THCredentials) LastModificationDate ¶
func (x *THCredentials) LastModificationDate() *foundation.NSDate
The date and time that the framework updated the credential in the database.
LastModificationDate calls the underlying LastModificationDate.
func (*THCredentials) NetworkKey ¶
func (x *THCredentials) NetworkKey() *foundation.NSData
The sixteen byte Thread network key.
NetworkKey calls the underlying NetworkKey.
func (*THCredentials) NetworkName ¶
func (x *THCredentials) NetworkName() string
The Thread network name.
NetworkName calls the underlying NetworkName.
func (*THCredentials) PSKC ¶
func (x *THCredentials) PSKC() *foundation.NSData
The sixteen byte Thread network pre-shared key for the Commissioner.
PSKC calls the underlying PSKC.
func (*THCredentials) PanID ¶
func (x *THCredentials) PanID() *foundation.NSData
The two byte Thead network PAN identifier.
PanID calls the underlying PanID.
func (*THCredentials) SetChannel ¶
func (x *THCredentials) SetChannel(channel uint8)
SetChannel calls the underlying SetChannel.
func (*THCredentials) Unwrap ¶
func (x *THCredentials) Unwrap() *raw.THCredentials
Unwrap returns the underlying raw.THCredentials.
func (*THCredentials) WithChannel ¶
func (x *THCredentials) WithChannel(channel uint8) *THCredentials
The Thread network radio channel.
WithChannel sets the channel property and returns the receiver for chaining.
type THCredentialsable ¶
type THCredentialsable interface {
Unwrap() *raw.THCredentials
WithChannel(channel uint8) *THCredentials
NetworkName() string
ExtendedPANID() *foundation.NSData
BorderAgentID() *foundation.NSData
ActiveOperationalDataSet() *foundation.NSData
NetworkKey() *foundation.NSData
PSKC() *foundation.NSData
Channel() uint8
SetChannel(channel uint8)
PanID() *foundation.NSData
CreationDate() *foundation.NSDate
LastModificationDate() *foundation.NSDate
}
THCredentialsable is the interface implemented by THCredentials, for mocking and DI.