Skip to content

Commit

Permalink
Providing a Common MQTT Mapper
Browse files Browse the repository at this point in the history
Signed-off-by: Prometheus-collab <[email protected]>
Signed-off-by: fuchendou <[email protected]>
  • Loading branch information
Prometheus-collab authored and fuchendou committed Oct 12, 2024
1 parent 782b438 commit d9568d1
Show file tree
Hide file tree
Showing 5 changed files with 381 additions and 139 deletions.
4 changes: 2 additions & 2 deletions mappers/mqtt-mapper/config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
grpc_server:
socket_path: /etc/kubeedge/kubeedge-v1.17.0.sock
common:
name: Kubeedge-V1.17.0-mapper
name: github.com/kubeedge/mqtt-mapper
version: v1.13.0
api_version: v1.0.0
protocol: # TODO add your protocol name
protocol: mqtt
address: 127.0.0.1
edgecore_sock: /etc/kubeedge/dmi.sock
11 changes: 6 additions & 5 deletions mappers/mqtt-mapper/driver/devicetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type CustomizedClient struct {
// TODO add some variables to help you better implement device drivers
deviceMutex sync.Mutex
ProtocolConfig
DeviceInfo string `json:"deviceInfo"`
ParsedDeviceInfo map[string]interface{} `json:"parsedDeviceInfo"`
TempMessage string `json:"tempMessage"`
DeviceConfigData interface{} `json:"deviceConfigData"`
}

type ProtocolConfig struct {
Expand All @@ -36,7 +36,6 @@ type ConfigData struct {
Password string `json:"password"` // Password for MQTT broker authentication
ConnectionTTL time.Duration `json:"connectionTTL"` // Connection timeout duration
LastMessage time.Time `json:"lastMessage"` // Timestamp of the last received message
IsData bool `json:"isData"` // Indicates if there is valid data
}

type VisitorConfig struct {
Expand All @@ -58,7 +57,10 @@ type VisitorConfigData struct {
type OperationInfoType uint

const (
UPDATE OperationInfoType = iota // revision
DEVICEINfO OperationInfoType = iota // set global device config data
UPDATE // update the device config data
SETSINGLEVALUE // find the most related setting value and update
GETSINGLEVALUE // find the most related setting value
)

// SerializedFormatType defines the enumeration values for serialized types.
Expand All @@ -68,5 +70,4 @@ const (
JSON SerializedFormatType = iota // json
YAML // yaml
XML // xml
JSONPATH
)
Loading

0 comments on commit d9568d1

Please sign in to comment.