Documentation ¶
Overview ¶
Package hc provides implementation of an IP transport for HomeKit accessories.
import ( "github.com/MrEhbr/hc" "github.com/MrEhbr/hc/accessory" ) acc := accessory.NewSwitch(...) config := hc.Config{Pin: "00102003"} t, err := hc.NewIPTransport(config, acc.Accessory) ... t.Start()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIPTransport ¶
func NewIPTransport(config Config, a *accessory.Accessory, as ...*accessory.Accessory) (*ipTransport, error)
NewIPTransport creates a transport to provide accessories over IP.
The IP transports stores the crypto keys inside a database, which is by default inside a folder at the current working directory. The folder is named exactly as the accessory name.
The transports can contain more than one accessory. If this is the case, the first accessory acts as the HomeKit bridge.
*Important:* Changing the name of the accessory, or letting multiple transports store the data inside the same database lead to unexpected behavior – don't do that.
The transport is secured with an 8-digit pin, which must be entered by an iOS client to successfully pair with the accessory. If the provided transport config does not specify any pin, 00102003 is used.
func NewPin ¶
NewPin returns a HomeKit compatible pin string from a 8-numbers strings e.g. '01020304'.
func OnTermination ¶
func OnTermination(fn TermFunc)
OnTermination calls a function when the app receives an interrupt of kill signal.
Types ¶
type Config ¶
type Config struct { // Path to the storage // When empty, the tranport stores the data inside a folder named exactly like the accessory StoragePath string // Port on which transport is reachable e.g. 12345 // When empty, the transport uses a random port Port string // Deprecated: Specifying a static IP is discouraged. IP string // Pin with has to be entered on iOS client to pair with the accessory // When empty, the pin 00102003 is used Pin string // SetupId used for setup code should be 4 uppercase letters SetupId string // contains filtered or unexported fields }
Config holds configuration options.
type TermFunc ¶
type TermFunc func()
TermFunc defines the function which is executed on termination.
type Transport ¶
type Transport interface { AddAccessory(a *accessory.Accessory) error RemoveAccessory(a *accessory.Accessory) // Start starts the transport Start() // Stop stops the transport // Use the returned channel to wait until the transport is fully stopped. Stop() <-chan struct{} }
Transport provides accessories over a network.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
THIS FILE IS AUTO-GENERATED Package accessory implements the HomeKit accessories.
|
THIS FILE IS AUTO-GENERATED Package accessory implements the HomeKit accessories. |
THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED Package characteristic implements the HomeKit characteristics.
|
THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED Package characteristic implements the HomeKit characteristics. |
Package crypto provides the crypthographic algorithm used in the HAP protocol.
|
Package crypto provides the crypthographic algorithm used in the HAP protocol. |
Package db implements persistent storage.
|
Package db implements persistent storage. |
Package hap implements the HomeKit Accessory Protocol to pair and securily communicate with a HomeKit client.
|
Package hap implements the HomeKit Accessory Protocol to pair and securily communicate with a HomeKit client. |
controller
Package controller implements the handler interfaces to access the model.
|
Package controller implements the handler interfaces to access the model. |
data
Package data provides structs to map json to objects.
|
Package data provides structs to map json to objects. |
endpoint
Package endpoint implements the HAP endpoints.
|
Package endpoint implements the HAP endpoints. |
http
Package http implements a http-like hap server to handle requests and responses.
|
Package http implements a http-like hap server to handle requests and responses. |
pair
Package pair implements the pairing and verification protocol.
|
Package pair implements the pairing and verification protocol. |
THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED Package service implements the HomeKit services.
|
THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED THIS FILE IS AUTO-GENERATED Package service implements the HomeKit services. |
Package util provides utilities.
|
Package util provides utilities. |