Documentation ¶
Overview ¶
Package services is a generated GoMock package.
Package services is a generated GoMock package.
Index ¶
- Variables
- func CloseGateway(gateway *Gateway) error
- func CloseHub(hub *Hub, ctx context.Context, gateway *GatewayRemote) error
- func OpenGateway(gateway *Gateway, ctx context.Context) error
- func OpenHub(hub *Hub, ctx context.Context, gateway *GatewayRemote) error
- func WaitGateway(gateway *Gateway) error
- func WaitHub(hub *Hub) error
- type Gateway
- func (w *Gateway) ForwardMoistureMeasurement(ctx context.Context, plantID string, measurement, defaultValue int) error
- func (w *Gateway) ForwardTemperatureMeasurement(ctx context.Context, roomID string, measurement, defaultValue int) error
- func (w *Gateway) RegisterFans(ctx context.Context, roomIDs []string) error
- func (w *Gateway) RegisterSprinklers(ctx context.Context, plantIDs []string) error
- func (w *Gateway) UnregisterFans(ctx context.Context, roomIDs []string) error
- func (w *Gateway) UnregisterSprinklers(ctx context.Context, plantIDs []string) error
- type GatewayRemote
- type Hub
- type HubRemote
- type MockClient
- func (m *MockClient) AddRoute(arg0 string, arg1 mqtt.MessageHandler)
- func (m *MockClient) Connect() mqtt.Token
- func (m *MockClient) Disconnect(arg0 uint)
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) IsConnected() bool
- func (m *MockClient) IsConnectionOpen() bool
- func (m *MockClient) OptionsReader() mqtt.ClientOptionsReader
- func (m *MockClient) Publish(arg0 string, arg1 byte, arg2 bool, arg3 interface{}) mqtt.Token
- func (m *MockClient) Subscribe(arg0 string, arg1 byte, arg2 mqtt.MessageHandler) mqtt.Token
- func (m *MockClient) SubscribeMultiple(arg0 map[string]byte, arg1 mqtt.MessageHandler) mqtt.Token
- func (m *MockClient) Unsubscribe(arg0 ...string) mqtt.Token
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) AddRoute(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Connect() *gomock.Call
- func (mr *MockClientMockRecorder) Disconnect(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) IsConnected() *gomock.Call
- func (mr *MockClientMockRecorder) IsConnectionOpen() *gomock.Call
- func (mr *MockClientMockRecorder) OptionsReader() *gomock.Call
- func (mr *MockClientMockRecorder) Publish(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Subscribe(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) SubscribeMultiple(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Unsubscribe(arg0 ...interface{}) *gomock.Call
- type MockIoTee
- func (m *MockIoTee) Close()
- func (m *MockIoTee) EXPECT() *MockIoTeeMockRecorder
- func (m *MockIoTee) Open() error
- func (m *MockIoTee) ReceiveBlocking() *iotee.Message
- func (m *MockIoTee) ReceiveWithTimeout(arg0 time.Duration) *iotee.Message
- func (m *MockIoTee) RxChan() chan *iotee.Message
- func (m *MockIoTee) RxPump()
- func (m *MockIoTee) Transmit(arg0 *iotee.Message) error
- type MockIoTeeMockRecorder
- func (mr *MockIoTeeMockRecorder) Close() *gomock.Call
- func (mr *MockIoTeeMockRecorder) Open() *gomock.Call
- func (mr *MockIoTeeMockRecorder) ReceiveBlocking() *gomock.Call
- func (mr *MockIoTeeMockRecorder) ReceiveWithTimeout(arg0 interface{}) *gomock.Call
- func (mr *MockIoTeeMockRecorder) RxChan() *gomock.Call
- func (mr *MockIoTeeMockRecorder) RxPump() *gomock.Call
- func (mr *MockIoTeeMockRecorder) Transmit(arg0 interface{}) *gomock.Call
- type MockToken
- type MockTokenMockRecorder
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CloseGateway ¶
CloseGateway function stops the gateway operation by unsubscribing from the MQTT topics and closing the error channel.
func CloseHub ¶
func CloseHub(hub *Hub, ctx context.Context, gateway *GatewayRemote) error
CloseHub performs cleanup operations on the hub such as unregistering fans and sprinklers and closing channels.
func OpenGateway ¶
OpenGateway function initializes gateway functionality by subscribing to fan and sprinkler MQTT topics.
func OpenHub ¶
func OpenHub(hub *Hub, ctx context.Context, gateway *GatewayRemote) error
OpenHub fires up the hub by registering fans and sprinklers with the gateway, and setting up temperature and moisture sensor handling.
func WaitGateway ¶
WaitGateway is a helper function to handle errors from the gateway.
Types ¶
type Gateway ¶
func NewGateway ¶
func (*Gateway) ForwardMoistureMeasurement ¶
func (w *Gateway) ForwardMoistureMeasurement(ctx context.Context, plantID string, measurement, defaultValue int) error
ForwardMoistureMeasurement function is used to forward moisture measurements to the broker.
func (*Gateway) ForwardTemperatureMeasurement ¶
func (w *Gateway) ForwardTemperatureMeasurement(ctx context.Context, roomID string, measurement, defaultValue int) error
ForwardTemperatureMeasurement function is used to forward temperature measurements to the broker.
func (*Gateway) RegisterFans ¶
RegisterFans method registers the rooms to the fans
func (*Gateway) RegisterSprinklers ¶
RegisterSprinklers method registers the plants to the sprinklers
func (*Gateway) UnregisterFans ¶
UnregisterFans method unregisters the rooms from the fans
type GatewayRemote ¶
type GatewayRemote struct { RegisterFans func(ctx context.Context, roomIDs []string) error UnregisterFans func(ctx context.Context, roomIDs []string) error ForwardTemperatureMeasurement func(ctx context.Context, roomID string, measurement, defaultValue int) error RegisterSprinklers func(ctx context.Context, plantIDs []string) error UnregisterSprinklers func(ctx context.Context, plantIDs []string) error ForwardMoistureMeasurement func(ctx context.Context, plantID string, measurement, defaultValue int) error }
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func NewHub ¶
func NewHub( verbose bool, ctx context.Context, fans map[string]utils.IoTee, temperatureSensors map[string]utils.IoTee, defaultTemperature int, sprinklers map[string]utils.IoTee, moistureSensors map[string]utils.IoTee, defaultMoisture int, measureInterval, measureTimeout time.Duration, mock int, ) *Hub
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) AddRoute ¶
func (m *MockClient) AddRoute(arg0 string, arg1 mqtt.MessageHandler)
AddRoute mocks base method.
func (*MockClient) Disconnect ¶
func (m *MockClient) Disconnect(arg0 uint)
Disconnect mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) IsConnected ¶
func (m *MockClient) IsConnected() bool
IsConnected mocks base method.
func (*MockClient) IsConnectionOpen ¶
func (m *MockClient) IsConnectionOpen() bool
IsConnectionOpen mocks base method.
func (*MockClient) OptionsReader ¶
func (m *MockClient) OptionsReader() mqtt.ClientOptionsReader
OptionsReader mocks base method.
func (*MockClient) Subscribe ¶
func (m *MockClient) Subscribe(arg0 string, arg1 byte, arg2 mqtt.MessageHandler) mqtt.Token
Subscribe mocks base method.
func (*MockClient) SubscribeMultiple ¶
func (m *MockClient) SubscribeMultiple(arg0 map[string]byte, arg1 mqtt.MessageHandler) mqtt.Token
SubscribeMultiple mocks base method.
func (*MockClient) Unsubscribe ¶
func (m *MockClient) Unsubscribe(arg0 ...string) mqtt.Token
Unsubscribe mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) AddRoute ¶
func (mr *MockClientMockRecorder) AddRoute(arg0, arg1 interface{}) *gomock.Call
AddRoute indicates an expected call of AddRoute.
func (*MockClientMockRecorder) Connect ¶
func (mr *MockClientMockRecorder) Connect() *gomock.Call
Connect indicates an expected call of Connect.
func (*MockClientMockRecorder) Disconnect ¶
func (mr *MockClientMockRecorder) Disconnect(arg0 interface{}) *gomock.Call
Disconnect indicates an expected call of Disconnect.
func (*MockClientMockRecorder) IsConnected ¶
func (mr *MockClientMockRecorder) IsConnected() *gomock.Call
IsConnected indicates an expected call of IsConnected.
func (*MockClientMockRecorder) IsConnectionOpen ¶
func (mr *MockClientMockRecorder) IsConnectionOpen() *gomock.Call
IsConnectionOpen indicates an expected call of IsConnectionOpen.
func (*MockClientMockRecorder) OptionsReader ¶
func (mr *MockClientMockRecorder) OptionsReader() *gomock.Call
OptionsReader indicates an expected call of OptionsReader.
func (*MockClientMockRecorder) Publish ¶
func (mr *MockClientMockRecorder) Publish(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Publish indicates an expected call of Publish.
func (*MockClientMockRecorder) Subscribe ¶
func (mr *MockClientMockRecorder) Subscribe(arg0, arg1, arg2 interface{}) *gomock.Call
Subscribe indicates an expected call of Subscribe.
func (*MockClientMockRecorder) SubscribeMultiple ¶
func (mr *MockClientMockRecorder) SubscribeMultiple(arg0, arg1 interface{}) *gomock.Call
SubscribeMultiple indicates an expected call of SubscribeMultiple.
func (*MockClientMockRecorder) Unsubscribe ¶
func (mr *MockClientMockRecorder) Unsubscribe(arg0 ...interface{}) *gomock.Call
Unsubscribe indicates an expected call of Unsubscribe.
type MockIoTee ¶
type MockIoTee struct {
// contains filtered or unexported fields
}
MockIoTee is a mock of IoTee interface.
func NewMockIoTee ¶
func NewMockIoTee(ctrl *gomock.Controller) *MockIoTee
NewMockIoTee creates a new mock instance.
func (*MockIoTee) EXPECT ¶
func (m *MockIoTee) EXPECT() *MockIoTeeMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockIoTee) ReceiveBlocking ¶
ReceiveBlocking mocks base method.
func (*MockIoTee) ReceiveWithTimeout ¶
ReceiveWithTimeout mocks base method.
type MockIoTeeMockRecorder ¶
type MockIoTeeMockRecorder struct {
// contains filtered or unexported fields
}
MockIoTeeMockRecorder is the mock recorder for MockIoTee.
func (*MockIoTeeMockRecorder) Close ¶
func (mr *MockIoTeeMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockIoTeeMockRecorder) Open ¶
func (mr *MockIoTeeMockRecorder) Open() *gomock.Call
Open indicates an expected call of Open.
func (*MockIoTeeMockRecorder) ReceiveBlocking ¶
func (mr *MockIoTeeMockRecorder) ReceiveBlocking() *gomock.Call
ReceiveBlocking indicates an expected call of ReceiveBlocking.
func (*MockIoTeeMockRecorder) ReceiveWithTimeout ¶
func (mr *MockIoTeeMockRecorder) ReceiveWithTimeout(arg0 interface{}) *gomock.Call
ReceiveWithTimeout indicates an expected call of ReceiveWithTimeout.
func (*MockIoTeeMockRecorder) RxChan ¶
func (mr *MockIoTeeMockRecorder) RxChan() *gomock.Call
RxChan indicates an expected call of RxChan.
func (*MockIoTeeMockRecorder) RxPump ¶
func (mr *MockIoTeeMockRecorder) RxPump() *gomock.Call
RxPump indicates an expected call of RxPump.
func (*MockIoTeeMockRecorder) Transmit ¶
func (mr *MockIoTeeMockRecorder) Transmit(arg0 interface{}) *gomock.Call
Transmit indicates an expected call of Transmit.
type MockToken ¶
type MockToken struct {
// contains filtered or unexported fields
}
MockToken is a mock of Token interface.
func NewMockToken ¶
func NewMockToken(ctrl *gomock.Controller) *MockToken
NewMockToken creates a new mock instance.
func (*MockToken) EXPECT ¶
func (m *MockToken) EXPECT() *MockTokenMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTokenMockRecorder ¶
type MockTokenMockRecorder struct {
// contains filtered or unexported fields
}
MockTokenMockRecorder is the mock recorder for MockToken.
func (*MockTokenMockRecorder) Done ¶
func (mr *MockTokenMockRecorder) Done() *gomock.Call
Done indicates an expected call of Done.
func (*MockTokenMockRecorder) Error ¶
func (mr *MockTokenMockRecorder) Error() *gomock.Call
Error indicates an expected call of Error.
func (*MockTokenMockRecorder) Wait ¶
func (mr *MockTokenMockRecorder) Wait() *gomock.Call
Wait indicates an expected call of Wait.
func (*MockTokenMockRecorder) WaitTimeout ¶
func (mr *MockTokenMockRecorder) WaitTimeout(arg0 interface{}) *gomock.Call
WaitTimeout indicates an expected call of WaitTimeout.