Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the part of inittwin in ble mapper #62

Open
1180300515 opened this issue Nov 30, 2021 · 0 comments
Open

the part of inittwin in ble mapper #62

1180300515 opened this issue Nov 30, 2021 · 0 comments

Comments

@1180300515
Copy link

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()
	}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant