diff options
| author | wbc6080 <wangbincheng4@huawei.com> | 2023-12-12 17:40:14 +0800 |
|---|---|---|
| committer | wbc6080 <wangbincheng4@huawei.com> | 2023-12-12 17:40:14 +0800 |
| commit | 757b5009c7ccbfe0d6444b95d8d0847aab953b4d (patch) | |
| tree | 44187385a27f7384cc80a77a7f416da1afdc49e7 /staging | |
| parent | Merge pull request #5250 from wbc6080/change-dmiapi-vendor (diff) | |
| download | kubeedge-757b5009c7ccbfe0d6444b95d8d0847aab953b4d.tar.gz | |
remove unused protocol field
Signed-off-by: wbc6080 <wangbincheng4@huawei.com>
Diffstat (limited to 'staging')
3 files changed, 5 insertions, 11 deletions
diff --git a/staging/src/github.com/kubeedge/mapper-framework/_template/mapper/device/device.go b/staging/src/github.com/kubeedge/mapper-framework/_template/mapper/device/device.go index bdadcb3c6..e8d618814 100644 --- a/staging/src/github.com/kubeedge/mapper-framework/_template/mapper/device/device.go +++ b/staging/src/github.com/kubeedge/mapper-framework/_template/mapper/device/device.go @@ -29,7 +29,6 @@ type DevPanel struct { deviceMuxs map[string]context.CancelFunc devices map[string]*driver.CustomizedDev models map[string]common.DeviceModel - protocols map[string]common.ProtocolConfig wg sync.WaitGroup serviceMutex sync.Mutex quitChan chan os.Signal @@ -47,7 +46,6 @@ func NewDevPanel() *DevPanel { deviceMuxs: make(map[string]context.CancelFunc), devices: make(map[string]*driver.CustomizedDev), models: make(map[string]common.DeviceModel), - protocols: make(map[string]common.ProtocolConfig), wg: sync.WaitGroup{}, serviceMutex: sync.Mutex{}, quitChan: make(chan os.Signal), @@ -367,7 +365,7 @@ func (d *DevPanel) DevInit(cfg *config.Config) error { // return err // } case common.DevInitModeRegister: - if err := parse.ParseByUsingRegister(devs, d.models, d.protocols); err != nil { + if err := parse.ParseByUsingRegister(devs, d.models); err != nil { return err } } @@ -381,7 +379,7 @@ func (d *DevPanel) DevInit(cfg *config.Config) error { } // UpdateDev stop old device, then update and start new device -func (d *DevPanel) UpdateDev(model *common.DeviceModel, device *common.DeviceInstance, protocol *common.ProtocolConfig) { +func (d *DevPanel) UpdateDev(model *common.DeviceModel, device *common.DeviceInstance) { d.serviceMutex.Lock() defer d.serviceMutex.Unlock() @@ -395,7 +393,6 @@ func (d *DevPanel) UpdateDev(model *common.DeviceModel, device *common.DeviceIns d.devices[device.ID] = new(driver.CustomizedDev) d.devices[device.ID].Instance = *device d.models[device.ID] = *model - d.protocols[device.ID] = *protocol ctx, cancelFunc := context.WithCancel(context.Background()) d.deviceMuxs[device.ID] = cancelFunc @@ -413,8 +410,7 @@ func (d *DevPanel) UpdateDevTwins(deviceID string, twins []common.Twin) error { } dev.Instance.Twins = twins model := d.models[dev.Instance.Model] - protocol := d.protocols[dev.Instance.ProtocolName] - d.UpdateDev(&model, &dev.Instance, &protocol) + d.UpdateDev(&model, &dev.Instance) return nil } diff --git a/staging/src/github.com/kubeedge/mapper-framework/pkg/global/global.go b/staging/src/github.com/kubeedge/mapper-framework/pkg/global/global.go index f76185816..d3bf98a28 100644 --- a/staging/src/github.com/kubeedge/mapper-framework/pkg/global/global.go +++ b/staging/src/github.com/kubeedge/mapper-framework/pkg/global/global.go @@ -12,7 +12,7 @@ type DevPanel interface { // DevInit get device info by dmi interface DevInit(cfg *config.Config) error // UpdateDev update device's config and restart the device - UpdateDev(model *common.DeviceModel, device *common.DeviceInstance, protocol *common.ProtocolConfig) + UpdateDev(model *common.DeviceModel, device *common.DeviceInstance) // UpdateDevTwins update device twin's config and restart the device UpdateDevTwins(deviceID string, twins []common.Twin) error // DealDeviceTwinGet get device's twin data diff --git a/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/parse.go b/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/parse.go index 74558bbd8..4c37a7476 100644 --- a/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/parse.go +++ b/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/parse.go @@ -28,8 +28,7 @@ import ( var ErrEmptyData error = errors.New("device or device model list is empty") func ParseByUsingRegister(devices map[string]*common.DeviceInstance, - dms map[string]common.DeviceModel, - protocols map[string]common.ProtocolConfig) error { + dms map[string]common.DeviceModel) error { deviceList, deviceModelList, err := grpcclient.RegisterMapper(true) if err != nil { return err @@ -59,7 +58,6 @@ func ParseByUsingRegister(devices map[string]*common.DeviceInstance, devices[instance.ID] = instance klog.V(4).Info("Instance: ", instance.ID) dms[instance.Model] = modelMap[instance.Model] - protocols[instance.ProtocolName] = protocol } return nil |
