Documentation
¶
Index ¶
- Constants
- func AddrEqualAddr(a string, b string) bool
- func Decode(data []byte, x interface{}) error
- func Decrypt(data []byte, passphrase string) ([]byte, error)
- func Encode(x interface{}) ([]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 BLEPacket
- type PacketAggregator
- func (pa *PacketAggregator) AddData(data []byte) (string, error)
- func (pa *PacketAggregator) AddPacketFromPacketBytes(packetBytes []byte) (string, error)
- func (pa *PacketAggregator) HasDataFromPacketStream(guid string) bool
- func (pa *PacketAggregator) PopAllDataFromPackets(guid string) ([]byte, error)
- func (pa *PacketAggregator) PopPacketDataFromStream(guid string) ([]byte, bool, error)
- type TimeSync
- type TryCatchBlock
Constants ¶
const ( // MTU is used for the max size of bytes allowed for data transmittion between ble client and server MTU = 256 // 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 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 PacketAggregator ¶
type PacketAggregator struct {
// contains filtered or unexported fields
}
PacketAggregator is a struct with function to get constructed & validated data
func NewPacketAggregator ¶
func NewPacketAggregator() PacketAggregator
NewPacketAggregator makes new struct for packet aggregation
func (*PacketAggregator) AddData ¶
func (pa *PacketAggregator) AddData(data []byte) (string, error)
AddData will take input bytes, get packets from bytes, and call AddPacketFromPacketBytes black box
func (*PacketAggregator) AddPacketFromPacketBytes ¶
func (pa *PacketAggregator) AddPacketFromPacketBytes(packetBytes []byte) (string, error)
AddPacketFromPacketBytes will take the input bytes, parse to packet struct, and add to store (returns guid)
func (*PacketAggregator) HasDataFromPacketStream ¶
func (pa *PacketAggregator) HasDataFromPacketStream(guid string) bool
HasDataFromPacketStream returns true if all packet data is in correctly for a given guid stream
func (*PacketAggregator) PopAllDataFromPackets ¶
func (pa *PacketAggregator) PopAllDataFromPackets(guid string) ([]byte, error)
PopAllDataFromPackets aggregates all the packets and confirms if data accurate
func (*PacketAggregator) PopPacketDataFromStream ¶
func (pa *PacketAggregator) PopPacketDataFromStream(guid string) ([]byte, bool, error)
PopPacketDataFromStream returns next packet in (index) order in the given guid stream
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()