Documentation
¶
Index ¶
- type BaseService
- func (bds *BaseService) ActiveDevice(device commons.DeviceMeta, isIPC bool) error
- func (bds *BaseService) AddDevice(device commons.DeviceMeta, isIPC bool) error
- func (bds *BaseService) AllDevices() map[string]commons.DeviceInfo
- func (bds *BaseService) ChangeLogLevel(level string) error
- func (bds *BaseService) CmdResultUpload(sn int64, success int, message string) error
- func (bds *BaseService) DelBackupKV(keys []string) error
- func (bds *BaseService) DeleteDevice(cid string) error
- func (bds *BaseService) DeleteKV(keys []string) error
- func (bds *BaseService) DriverProxyRegist(host string, port int) error
- func (bds *BaseService) GetActiveDeviceById(cid string) (commons.DeviceInfo, bool)
- func (bds *BaseService) GetActiveDevices() map[string]commons.DeviceInfo
- func (bds *BaseService) GetAppHandler() commons.AppCallBack
- func (bds *BaseService) GetBackupKV(keys []string) (map[string][]byte, error)
- func (bds *BaseService) GetBackupKVKeys(prefix string) ([]string, error)
- func (bds *BaseService) GetCloudStatus() bool
- func (bds *BaseService) GetContext() (context.Context, context.CancelFunc)
- func (bds *BaseService) GetDevCache() *cache.DeviceCache
- func (bds *BaseService) GetDeviceById(cid string) (commons.DeviceInfo, bool)
- func (bds *BaseService) GetDriverConfig() map[string]interface{}
- func (bds *BaseService) GetGatewayId() string
- func (bds *BaseService) GetGatewayMeta() commons.GatewayInfo
- func (bds *BaseService) GetKV(keys []string) (map[string][]byte, error)
- func (bds *BaseService) GetKVKeys(prefix string) ([]string, error)
- func (bds *BaseService) GetLogger() commons.TedgeLogger
- func (bds *BaseService) GetRPCConfig() config.RPCConfig
- func (bds *BaseService) GetServiceId() string
- func (bds *BaseService) GetServiceName() string
- func (bds *BaseService) GetTEdgeModel() commons.RunningModel
- func (bds *BaseService) PutBackupKV(kvs map[string][]byte) error
- func (bds *BaseService) PutKv(kvs map[string][]byte) error
- func (bds *BaseService) QueryBackupKV(prefix string) (map[string][]byte, error)
- func (bds *BaseService) QueryKV(prefix string) (map[string][]byte, error)
- func (bds *BaseService) ReportAlert(ctx context.Context, level commons.AlertLevel, content string) error
- func (bds *BaseService) ReportDevEvent(deviceId, event_type, deviceAddr, content string) error
- func (bds *BaseService) ReportDeviceStatus(data *commons.DeviceStatus) error
- func (bds *BaseService) ReportThroughHttp(api, version string, payload map[string]interface{}) (string, error)
- func (bds *BaseService) ReportTuyaDeviceStatus(data *commons.DeviceStatus) error
- func (bds *BaseService) SendToApp(ctx context.Context, appName string, req commons.AppDriverReq, cnnNum ...int) (commons.Response, error)
- func (bds *BaseService) SetCloudStatus(status bool)
- func (bds *BaseService) SetDeviceBaseAttr(cid string, baseAttr commons.BaseProperty) error
- func (bds *BaseService) SetDeviceProperty(cid string, property commons.ExtendedProperty) error
- func (bds *BaseService) UpdateAppAddress(ctx context.Context, req *proto.AppBaseAddress) error
- func (bds *BaseService) UploadFile(content []byte, fileName, subjectType string, timeout int32) (string, error)
- func (bds *BaseService) UploadFileV2(cid, fileName string, content []byte, timeout int32) (string, string, error)
- type ConfigManger
- type DPModelService
- func (dds *DPModelService) AddProduct(p dpmodel.DPModelProductAddInfo) error
- func (dds *DPModelService) AllProducts() map[string]dpmodel.DPModelProduct
- func (dds *DPModelService) AtopReReport(key string, data []byte) error
- func (dds *DPModelService) DPRePublish(cid string, data []byte) error
- func (dds *DPModelService) GetDriver() dpmodel.DPModelDriver
- func (dds *DPModelService) GetPdCache() *cache.DPModelProductCache
- func (dds *DPModelService) GetProductById(pid string) (dpmodel.DPModelProduct, bool)
- func (dds *DPModelService) IpcDeviceUpdateSkill(version, cid string) (string, error)
- func (dds *DPModelService) ReportHttpWithRetrans(api, version string, payload map[string]interface{}) (string, error)
- func (dds *DPModelService) ReportWithDPData(cid string, data []*dpmodel.WithDPValue) error
- func (dds *DPModelService) ReportWithDPDataV2(cid string, data []*dpmodel.WithDPValue) error
- func (dds *DPModelService) ReportWithoutDPData(topic string, data *dpmodel.WithoutDPValue) error
- func (dds *DPModelService) Start(driver dpmodel.DPModelDriver, opts ...commons.Option) error
- func (dds *DPModelService) SyncDeviceAndProduct()
- type TyModelService
- func (tmds *TyModelService) ActionExecuteResponse(cid string, data thingmodel.ActionExecuteResponse) error
- func (tmds *TyModelService) ActiveLinkDevice(device commons.TMDeviceMeta) error
- func (tmds *TyModelService) AddLinkDevice(device commons.TMDeviceMeta) error
- func (tmds *TyModelService) AddProduct(pr thingmodel.AddProductReq) error
- func (tmds *TyModelService) AllProducts() map[string]thingmodel.ThingModelProduct
- func (tmds *TyModelService) AllTMDevices() map[string]commons.TMDeviceInfo
- func (tmds *TyModelService) BatchReport(cid string, data thingmodel.BatchReport) (thingmodel.CommonResponse, error)
- func (tmds *TyModelService) EventReport(cid string, data thingmodel.EventReport) (thingmodel.CommonResponse, error)
- func (tmds *TyModelService) GenRandomId() string
- func (tmds *TyModelService) GetDriver() thingmodel.ThingModelDriver
- func (tmds *TyModelService) GetEventByPid(pid string) (map[string]thingmodel.Event, bool)
- func (tmds *TyModelService) GetLinkActiveDevices() map[string]commons.TMDeviceInfo
- func (tmds *TyModelService) GetPdCache() *cache.ThingModelProductCache
- func (tmds *TyModelService) GetProductById(pid string) (thingmodel.ThingModelProduct, bool)
- func (tmds *TyModelService) GetTMDeviceById(cid string) (commons.TMDeviceInfo, bool)
- func (tmds *TyModelService) GetTMWorkerPool() *worker.TMWorkerPool
- func (tmds *TyModelService) HttpRequestProxy(params thingmodel.HttpRequestParam, payload map[string]interface{}, ...) (string, error)
- func (tmds *TyModelService) PropertyDesiredDelete(cid string, data thingmodel.PropertyDesiredDelete) (thingmodel.PropertyDesiredDeleteResponse, error)
- func (tmds *TyModelService) PropertyDesiredGet(cid string, data thingmodel.PropertyDesiredGet) (thingmodel.PropertyDesiredGetResponse, error)
- func (tmds *TyModelService) PropertyGetResponse(cid string, data thingmodel.PropertyGetResponse) error
- func (tmds *TyModelService) PropertyReport(cid string, data thingmodel.PropertyReport) (thingmodel.CommonResponse, error)
- func (tmds *TyModelService) PropertySetResponse(cid string, data thingmodel.CommonResponse) error
- func (tmds *TyModelService) Start(driver thingmodel.ThingModelDriver, opts ...commons.Option) error
- func (tmds *TyModelService) SyncDeviceAndProduct()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseService ¶
type BaseService struct { MqttClient *mqttclient.MqttClient // contains filtered or unexported fields }
func NewBaseService ¶
func NewBaseService(l commons.TedgeLogger) *BaseService
func (*BaseService) ActiveDevice ¶
func (bds *BaseService) ActiveDevice(device commons.DeviceMeta, isIPC bool) error
//////////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) AddDevice ¶
func (bds *BaseService) AddDevice(device commons.DeviceMeta, isIPC bool) error
func (*BaseService) AllDevices ¶
func (bds *BaseService) AllDevices() map[string]commons.DeviceInfo
////////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) ChangeLogLevel ¶
func (bds *BaseService) ChangeLogLevel(level string) error
func (*BaseService) CmdResultUpload ¶
func (bds *BaseService) CmdResultUpload(sn int64, success int, message string) error
func (*BaseService) DelBackupKV ¶
func (bds *BaseService) DelBackupKV(keys []string) error
新的KV方法,删除KV,KV支持云端备份
func (*BaseService) DeleteDevice ¶
func (bds *BaseService) DeleteDevice(cid string) error
func (*BaseService) DeleteKV ¶
func (bds *BaseService) DeleteKV(keys []string) error
func (*BaseService) DriverProxyRegist ¶
func (bds *BaseService) DriverProxyRegist(host string, port int) error
///////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) GetActiveDeviceById ¶
func (bds *BaseService) GetActiveDeviceById(cid string) (commons.DeviceInfo, bool)
func (*BaseService) GetActiveDevices ¶
func (bds *BaseService) GetActiveDevices() map[string]commons.DeviceInfo
func (*BaseService) GetAppHandler ¶
func (bds *BaseService) GetAppHandler() commons.AppCallBack
func (*BaseService) GetBackupKV ¶
func (bds *BaseService) GetBackupKV(keys []string) (map[string][]byte, error)
新的KV方法,根据key获取KV,获取到的KV存储支持云端备份
func (*BaseService) GetBackupKVKeys ¶
func (bds *BaseService) GetBackupKVKeys(prefix string) ([]string, error)
新的KV方法,根据前缀获取key,获取到的KV存储支持云端备份
func (*BaseService) GetCloudStatus ¶
func (bds *BaseService) GetCloudStatus() bool
func (*BaseService) GetContext ¶
func (bds *BaseService) GetContext() (context.Context, context.CancelFunc)
func (*BaseService) GetDevCache ¶
func (bds *BaseService) GetDevCache() *cache.DeviceCache
func (*BaseService) GetDeviceById ¶
func (bds *BaseService) GetDeviceById(cid string) (commons.DeviceInfo, bool)
func (*BaseService) GetDriverConfig ¶
func (bds *BaseService) GetDriverConfig() map[string]interface{}
获取驱动自定义配置
func (*BaseService) GetGatewayId ¶
func (bds *BaseService) GetGatewayId() string
func (*BaseService) GetGatewayMeta ¶
func (bds *BaseService) GetGatewayMeta() commons.GatewayInfo
func (*BaseService) GetLogger ¶
func (bds *BaseService) GetLogger() commons.TedgeLogger
//////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) GetRPCConfig ¶
func (bds *BaseService) GetRPCConfig() config.RPCConfig
func (*BaseService) GetServiceId ¶
func (bds *BaseService) GetServiceId() string
//////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) GetServiceName ¶
func (bds *BaseService) GetServiceName() string
func (*BaseService) GetTEdgeModel ¶
func (bds *BaseService) GetTEdgeModel() commons.RunningModel
func (*BaseService) PutBackupKV ¶
func (bds *BaseService) PutBackupKV(kvs map[string][]byte) error
新的KV方法,更新KV,KV支持云端备份
func (*BaseService) QueryBackupKV ¶
func (bds *BaseService) QueryBackupKV(prefix string) (map[string][]byte, error)
/////////////////////////////////////////////////////////////////////////////////////////// 新的KV方法,获取到的KV存储支持云端备份
func (*BaseService) QueryKV ¶
func (bds *BaseService) QueryKV(prefix string) (map[string][]byte, error)
func (*BaseService) ReportAlert ¶
func (bds *BaseService) ReportAlert(ctx context.Context, level commons.AlertLevel, content string) error
func (*BaseService) ReportDevEvent ¶
func (bds *BaseService) ReportDevEvent(deviceId, event_type, deviceAddr, content string) error
func (*BaseService) ReportDeviceStatus ¶
func (bds *BaseService) ReportDeviceStatus(data *commons.DeviceStatus) error
////////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) ReportThroughHttp ¶
func (bds *BaseService) ReportThroughHttp(api, version string, payload map[string]interface{}) (string, error)
/////////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) ReportTuyaDeviceStatus ¶ added in v1.0.3
func (bds *BaseService) ReportTuyaDeviceStatus(data *commons.DeviceStatus) error
////////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) SendToApp ¶
func (bds *BaseService) SendToApp(ctx context.Context, appName string, req commons.AppDriverReq, cnnNum ...int) (commons.Response, error)
///////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) SetCloudStatus ¶
func (bds *BaseService) SetCloudStatus(status bool)
func (*BaseService) SetDeviceBaseAttr ¶
func (bds *BaseService) SetDeviceBaseAttr(cid string, baseAttr commons.BaseProperty) error
func (*BaseService) SetDeviceProperty ¶
func (bds *BaseService) SetDeviceProperty(cid string, property commons.ExtendedProperty) error
func (*BaseService) UpdateAppAddress ¶
func (bds *BaseService) UpdateAppAddress(ctx context.Context, req *proto.AppBaseAddress) error
func (*BaseService) UploadFile ¶
func (bds *BaseService) UploadFile(content []byte, fileName, subjectType string, timeout int32) (string, error)
////////////////////////////////////////////////////////////////////////////////////////////
func (*BaseService) UploadFileV2 ¶
type ConfigManger ¶
type ConfigManger struct {
// contains filtered or unexported fields
}
////////////////////////////////////////////////////////////////////////////////////////////
func (*ConfigManger) GetClient ¶
func (cm *ConfigManger) GetClient() map[string]config.ClientInfo
func (*ConfigManger) GetCustomConfig ¶
func (cm *ConfigManger) GetCustomConfig() map[string]interface{}
获取驱动自定义配置
func (*ConfigManger) GetService ¶
func (cm *ConfigManger) GetService() config.ServiceInfo
func (*ConfigManger) SetLogLevel ¶
func (cm *ConfigManger) SetLogLevel(level string)
func (*ConfigManger) WriteToFile ¶
func (cm *ConfigManger) WriteToFile() error
type DPModelService ¶
type DPModelService struct { *BaseService RtsManager *retrans.ReTransfer //DP重传manager // contains filtered or unexported fields }
func NewDPModelService ¶
func NewDPModelService(bds *BaseService) *DPModelService
func (*DPModelService) AddProduct ¶
func (dds *DPModelService) AddProduct(p dpmodel.DPModelProductAddInfo) error
func (*DPModelService) AllProducts ¶
func (dds *DPModelService) AllProducts() map[string]dpmodel.DPModelProduct
func (*DPModelService) AtopReReport ¶
func (dds *DPModelService) AtopReReport(key string, data []byte) error
/////////////////////////////////////////////////////////////////////////////////////////////// Atop 失败重传 key: api|version
func (*DPModelService) DPRePublish ¶
func (dds *DPModelService) DPRePublish(cid string, data []byte) error
DP断网续传接口
func (*DPModelService) GetDriver ¶
func (dds *DPModelService) GetDriver() dpmodel.DPModelDriver
func (*DPModelService) GetPdCache ¶
func (dds *DPModelService) GetPdCache() *cache.DPModelProductCache
//////////////////////////////////////////////////////////////////////////////////////////////////
func (*DPModelService) GetProductById ¶
func (dds *DPModelService) GetProductById(pid string) (dpmodel.DPModelProduct, bool)
GetProductById 根据产品ID查询产品信息
func (*DPModelService) IpcDeviceUpdateSkill ¶
func (dds *DPModelService) IpcDeviceUpdateSkill(version, cid string) (string, error)
激活子设备后,单独更新IPC能力集时使用
func (*DPModelService) ReportHttpWithRetrans ¶
func (dds *DPModelService) ReportHttpWithRetrans(api, version string, payload map[string]interface{}) (string, error)
Atop 重传策略: 1. timeout; http 网关返回非200? 2. atop 网关出错,通过 errorCode 进行过滤?
func (*DPModelService) ReportWithDPData ¶
func (dds *DPModelService) ReportWithDPData(cid string, data []*dpmodel.WithDPValue) error
///////////////////////////////////////////////////////////////////////////////////////////////////
func (*DPModelService) ReportWithDPDataV2 ¶
func (dds *DPModelService) ReportWithDPDataV2(cid string, data []*dpmodel.WithDPValue) error
func (*DPModelService) ReportWithoutDPData ¶
func (dds *DPModelService) ReportWithoutDPData(topic string, data *dpmodel.WithoutDPValue) error
func (*DPModelService) Start ¶
func (dds *DPModelService) Start(driver dpmodel.DPModelDriver, opts ...commons.Option) error
func (*DPModelService) SyncDeviceAndProduct ¶
func (dds *DPModelService) SyncDeviceAndProduct()
type TyModelService ¶
type TyModelService struct { *BaseService // contains filtered or unexported fields }
func NewTyModelService ¶
func NewTyModelService(bds *BaseService) *TyModelService
func (*TyModelService) ActionExecuteResponse ¶
func (tmds *TyModelService) ActionExecuteResponse(cid string, data thingmodel.ActionExecuteResponse) error
func (*TyModelService) ActiveLinkDevice ¶
func (tmds *TyModelService) ActiveLinkDevice(device commons.TMDeviceMeta) error
func (*TyModelService) AddLinkDevice ¶
func (tmds *TyModelService) AddLinkDevice(device commons.TMDeviceMeta) error
///////////////////////////////////////////////////////////////////////////////////////////
func (*TyModelService) AddProduct ¶
func (tmds *TyModelService) AddProduct(pr thingmodel.AddProductReq) error
func (*TyModelService) AllProducts ¶
func (tmds *TyModelService) AllProducts() map[string]thingmodel.ThingModelProduct
AllProducts 获取当前实例下的所有产品
func (*TyModelService) AllTMDevices ¶
func (tmds *TyModelService) AllTMDevices() map[string]commons.TMDeviceInfo
func (*TyModelService) BatchReport ¶
func (tmds *TyModelService) BatchReport(cid string, data thingmodel.BatchReport) (thingmodel.CommonResponse, error)
func (*TyModelService) EventReport ¶
func (tmds *TyModelService) EventReport(cid string, data thingmodel.EventReport) (thingmodel.CommonResponse, error)
func (*TyModelService) GenRandomId ¶
func (tmds *TyModelService) GenRandomId() string
func (*TyModelService) GetDriver ¶
func (tmds *TyModelService) GetDriver() thingmodel.ThingModelDriver
func (*TyModelService) GetEventByPid ¶
func (tmds *TyModelService) GetEventByPid(pid string) (map[string]thingmodel.Event, bool)
func (*TyModelService) GetLinkActiveDevices ¶
func (tmds *TyModelService) GetLinkActiveDevices() map[string]commons.TMDeviceInfo
func (*TyModelService) GetPdCache ¶
func (tmds *TyModelService) GetPdCache() *cache.ThingModelProductCache
func (*TyModelService) GetProductById ¶
func (tmds *TyModelService) GetProductById(pid string) (thingmodel.ThingModelProduct, bool)
GetProductById 根据产品ID获取产品信息
func (*TyModelService) GetTMDeviceById ¶
func (tmds *TyModelService) GetTMDeviceById(cid string) (commons.TMDeviceInfo, bool)
func (*TyModelService) GetTMWorkerPool ¶
func (tmds *TyModelService) GetTMWorkerPool() *worker.TMWorkerPool
func (*TyModelService) HttpRequestProxy ¶
func (tmds *TyModelService) HttpRequestProxy(params thingmodel.HttpRequestParam, payload map[string]interface{}, timeout int) (string, error)
///////////////////////////////////////////////////////////////////////////////////////////
func (*TyModelService) PropertyDesiredDelete ¶
func (tmds *TyModelService) PropertyDesiredDelete(cid string, data thingmodel.PropertyDesiredDelete) (thingmodel.PropertyDesiredDeleteResponse, error)
func (*TyModelService) PropertyDesiredGet ¶
func (tmds *TyModelService) PropertyDesiredGet(cid string, data thingmodel.PropertyDesiredGet) (thingmodel.PropertyDesiredGetResponse, error)
func (*TyModelService) PropertyGetResponse ¶
func (tmds *TyModelService) PropertyGetResponse(cid string, data thingmodel.PropertyGetResponse) error
func (*TyModelService) PropertyReport ¶
func (tmds *TyModelService) PropertyReport(cid string, data thingmodel.PropertyReport) (thingmodel.CommonResponse, error)
///////////////////////////////////////////////////////////////////////////////////////////
func (*TyModelService) PropertySetResponse ¶
func (tmds *TyModelService) PropertySetResponse(cid string, data thingmodel.CommonResponse) error
func (*TyModelService) Start ¶
func (tmds *TyModelService) Start(driver thingmodel.ThingModelDriver, opts ...commons.Option) error
func (*TyModelService) SyncDeviceAndProduct ¶
func (tmds *TyModelService) SyncDeviceAndProduct()