Documentation
¶
Index ¶
- Constants
- func AddrEqualAddr(a string, b string) bool
- func CatchErrs(fn func() error) error
- func Decode(data []byte, x interface{}) error
- func Decrypt(data []byte, passphrase string) ([]byte, error)
- func Encode(x interface{}) ([]byte, error)
- func EncodeDataAsPackets(payload []byte, secret string) ([][]byte, error)
- func Encrypt(data []byte, passphrase string) ([]byte, error)
- func MakeINFContext() context.Context
- func Optimize(fn func() error) error
- func ShortestPath(rssiMap map[string]map[string]int, forwarderAddr string, serverAddr string) ([]string, error)
- func Throw(up error)
- func Timeout(fn func() error, duration time.Duration) error
- func UnixTS() int64
- func UuidEqualStr(u ble.UUID, s string) bool
- func UuidToStr(u ble.UUID) string
- type PacketBuffer
- type TimeSync
- type TryCatchBlock
Constants ¶
View Source
const ( // MTU is used for the max size of bytes allowed for data transmittion between ble client and server MTU = 150 // MainServiceUUID represents UUID for ble service for all ble characteristics MainServiceUUID = "00010000-0001-1000-8000-00805F9B34FB" // ClientStateUUID represents UUID for ble characteristic which handles writes from client to server for client state changes ClientStateUUID = "00010000-0003-1000-8000-00805F9B34FB" // TimeSyncUUID represents UUID for ble clients to time sync with ble server TimeSyncUUID = "00010000-0004-1000-8000-00805F9B34FB" // ClientLogUUID represents UUID for ble clients to write logs to ClientLogUUID = "00010000-0006-1000-8000-00805F9B34FB" // WriteForwardCharUUID represents UUID for ble characteristic which handles forwarding of writes WriteForwardCharUUID = "00030000-0003-1000-8000-00805F9B34FB" // StartReadForwardCharUUID represents UUID for ble characteristic which handles forwarding of reads (start) StartReadForwardCharUUID = "00030000-0004-1000-8000-00805F9B34FB" // EndReadForwardCharUUID represents UUID for ble characteristic which handles forwarding of reads (end) EndReadForwardCharUUID = "00030000-0006-1000-8000-00805F9B34FB" // ReadRssiMapCharUUID represents UUID for ble characteristic which is a getter for rssi map data ReadRssiMapCharUUID = "00030000-0005-1000-8000-00805F9B34FB" // ReadConnectionGraphUUID represents UUID for ble characteristic which is a getter for connection graph data ReadConnectionGraphUUID = "00030000-0007-1000-8000-00805F9B34FB" )
Variables ¶
This section is empty.
Functions ¶
func AddrEqualAddr ¶
func EncodeDataAsPackets ¶ added in v0.0.7
func MakeINFContext ¶
func ShortestPath ¶
func ShortestPath(rssiMap map[string]map[string]int, forwarderAddr string, serverAddr string) ([]string, error)
ShortestPath tells forwarder which path to take to forward packets to server
Types ¶
type PacketBuffer ¶ added in v0.0.7
type PacketBuffer struct {
// contains filtered or unexported fields
}
func NewPacketBuffer ¶ added in v0.0.7
func NewPacketBuffer(secret string) *PacketBuffer
type TimeSync ¶
type TimeSync struct {
// contains filtered or unexported fields
}
TimeSync is a utility struct for syncing time with a given source of truth
func NewTimeSync ¶
NewTimeSync generates the utility struct for time syncing
type TryCatchBlock ¶
type TryCatchBlock struct { Try func() Catch func(error) Finally func() }
func (TryCatchBlock) Do ¶
func (tcf TryCatchBlock) Do()
Click to show internal directories.
Click to hide internal directories.