Skip to content

the part of inittwin in ble mapper #62

@1180300515

Description

@1180300515

now i have a ble device , the twin propertyName is on-off , as it's name ,it control the sensor on-off ,the question is that it's property is write,so i can't read it's value ,but the twin has the desire and report value,so how can i get the report value?
in the code about the func inittwin ,after the func setVisitor finish,it begin to judge whether the property is notify or read ,and then send the report value.but the property is write ,so i can't get the report value.
the code is from device.go

if (c.Property&ble.CharNotify) != 0 && c.CCCD != nil {
	wg.Add(1)
	go func() {
		if err := twinData.BleClient.Client.Subscribe(c, false, twinData.notificationHandler()); err != nil {
			klog.Errorf("Subscribe error: %v", err)
			wg.Done()
		}
	}()
} else if (c.Property & ble.CharRead) != 0 { // // read data actively
        timer := mappercommon.Timer{Function: twinData.Run, Duration: collectCycle, Times: 0}
	wg.Add(1)
	go func() {
		defer wg.Done()
		timer.Start()
	}()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions