-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Prometheus-collab <[email protected]> Signed-off-by: fuchendou <[email protected]>
- Loading branch information
Showing
31 changed files
with
163 additions
and
259 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
60 changes: 0 additions & 60 deletions
60
mappers/kubeedge-v1.17.0/mqtt-mapper/driver/messagequeue.go
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package driver | ||
|
||
import ( | ||
"sync" | ||
"time" | ||
|
||
"github.com/kubeedge/mapper-framework/pkg/common" | ||
) | ||
|
||
// CustomizedDev is the customized device configuration and client information. | ||
type CustomizedDev struct { | ||
CustomizedClient *CustomizedClient | ||
Instance common.DeviceInstance | ||
} | ||
|
||
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"` | ||
} | ||
|
||
type ProtocolConfig struct { | ||
ProtocolName string `json:"protocolName"` | ||
ConfigData `json:"configData"` | ||
} | ||
|
||
type ConfigData struct { | ||
// MQTT protocol config data | ||
ClientID string `json:"clientID"` // MQTT Client ID | ||
BrokerURL string `json:"brokerURL"` // MQTT Broker URL | ||
Topic string `json:"topic"` // Topic for publishing or subscribing | ||
Message string `json:"message"` // Content of the message | ||
Username string `json:"username"` // Username for MQTT broker authentication | ||
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 { | ||
ProtocolName string `json:"protocolName"` | ||
VisitorConfigData `json:"configData"` | ||
} | ||
|
||
type VisitorConfigData struct { | ||
DataType string `json:"dataType"` | ||
|
||
ClientID string `json:"clientID"` // MQTT Client ID | ||
DeviceInfo string `json:"deviceInfo"` // Device information, such as device identification or other important information. | ||
OperationInfo OperationInfoType `json:"operationInfo"` // Operation information, such as adding, deleting, modifying and so on. | ||
SerializedFormat SerializedFormatType `json:"fileType"` // Supported formats: json, xml and yaml. | ||
ParsedMessage map[string]interface{} `json:"parsedMessage"` // The parsed message | ||
} | ||
|
||
// OperationInfoType defines the enumeration values for device operation. | ||
type OperationInfoType uint | ||
|
||
const ( | ||
UPDATE OperationInfoType = iota // revision | ||
) | ||
|
||
// SerializedFormatType defines the enumeration values for serialized types. | ||
type SerializedFormatType uint | ||
|
||
const ( | ||
JSON SerializedFormatType = iota // json | ||
YAML // yaml | ||
XML // xml | ||
JSONPATH | ||
) |
Oops, something went wrong.