refactor(db): add constante for max QOS
This commit is contained in:
@@ -14,6 +14,8 @@ import (
|
||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||
)
|
||||
|
||||
const maxQoS = 2
|
||||
|
||||
// A MqttParams is the abstracted MQTT gateway.
|
||||
// It provides the MQTT parameters to initialize the connection and the method to add data.
|
||||
type MqttParams struct {
|
||||
@@ -69,7 +71,7 @@ func NewMqttGateway(p MqttParams) (*MqttGateway, error) {
|
||||
return nil, errors.New("[MQTT Gateway] Invalid client id")
|
||||
}
|
||||
|
||||
if p.Qos > 2 {
|
||||
if p.Qos > maxQoS {
|
||||
return nil, errors.New("[MQTT Gateway] Invalid QoS level")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user