Documentation ¶
Index ¶
- type Device
- type Station
- type TestClient
- func (testClient TestClient) CreateRandomStations(stationsNum int, pointsNum int, millisecondBetweenValuechange int) []*Station
- func (testClient *TestClient) GetSequence() uint64
- func (testClient TestClient) PublishPoints(millsecondBetweenBroadcast int)
- func (testClient TestClient) SendMessage(topic string, message interface{})
- func (testClient *TestClient) WriteData(station *Station, msgType string)
- func (testClient *TestClient) WriteNBirth()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Value interface{} // contains filtered or unexported fields }
Device holds a device with a topic and value
func CreateRandomDevice ¶
CreateRandomDevice creates a random device with specified topic parameters
func CreateRandomDevices ¶
CreateRandomDevices creates random devices of type, adds to Devices
type Station ¶
type Station struct { Devices []*Device // contains filtered or unexported fields }
Station Holds various devices as part of a station
func CreateRandomStations ¶
CreateRandomStations creates an array of Random Stations
type TestClient ¶
type TestClient struct { Opts *MQTT.ClientOptions PahoClient MQTT.Client Message MQTT.Message Seq uint64 Namespace string GroupID string EdgeNodeID string Stations []*Station }
TestClient class
func CreateTestClient ¶
func CreateTestClient(brokerIP string, port string, clientID string) *TestClient
CreateTestClient creates a test client and populated it with random devices/points
func NewClient ¶
func NewClient(ip string, port string, clientID string) *TestClient
NewClient Creates a client
func (TestClient) CreateRandomStations ¶
func (testClient TestClient) CreateRandomStations(stationsNum int, pointsNum int, millisecondBetweenValuechange int) []*Station
CreateRandomStations Return array of random stations with random devices with random values
func (*TestClient) GetSequence ¶
func (testClient *TestClient) GetSequence() uint64
GetSequence adds 1 to sequence and gets the sequence number (cap of 255 then returns to 0)
func (TestClient) PublishPoints ¶
func (testClient TestClient) PublishPoints(millsecondBetweenBroadcast int)
PublishPoints a
func (TestClient) SendMessage ¶
func (testClient TestClient) SendMessage(topic string, message interface{})
SendMessage Sends a message
func (*TestClient) WriteData ¶
func (testClient *TestClient) WriteData(station *Station, msgType string)
WriteData writes a message for all devices in Devices. msgType can be either DDATA or DBIRTH.
func (*TestClient) WriteNBirth ¶
func (testClient *TestClient) WriteNBirth()
WriteNBirth writes the NBirth message