Send response types in socket responses and create api package

This commit is contained in:
2021-10-22 20:47:57 -07:00
parent f001dd6079
commit 80a5867d6b
6 changed files with 317 additions and 4 deletions

View File

@@ -16,6 +16,22 @@ const (
ReqTypeWatchStepCount
)
const (
ResTypeHeartRate = iota
ResTypeBattLevel
ResTypeFwVersion
ResTypeDFUProgress
ResTypeBtAddress
ResTypeNotify
ResTypeSetTime
ResTypeWatchHeartRate
ResTypeWatchBattLevel
ResTypeMotion
ResTypeWatchMotion
ResTypeStepCount
ResTypeWatchStepCount
)
const (
UpgradeTypeArchive = iota
UpgradeTypeFiles
@@ -27,6 +43,7 @@ type ReqDataFwUpgrade struct {
}
type Response struct {
Type int
Value interface{} `json:"value,omitempty"`
Message string `json:"msg,omitempty"`
Error bool `json:"error"`