jefffhaynes / XBee

A .NET library for XBee wireless controllers
MIT License
40 stars 17 forks source link

No change. Node_SampleReceived is still not being called #38

Closed PaulNoto closed 6 years ago

PaulNoto commented 6 years ago

After updating to XBee.Core 1.5.5 Node_SampleReceived is still not being called. When I inspect the Node with the debugger, I can see that SampleReceived is set to Node_SampleReceived. As far as I can tell it should work, it just refuses to.

jefffhaynes commented 6 years ago

Ok, I’ll look at it more tomorrow but I might need to try to get some more debugging info from you if I can’t figure it out.


From: PaulNoto notifications@github.com Sent: Saturday, September 23, 2017 6:57:42 PM To: jefffhaynes/XBee Cc: Subscribed Subject: [jefffhaynes/XBee] No change. Node_SampleReceived is still not being called (#38)

After updating to XBee.Core 1.5.5 Node_SampleReceived is still not being called. When I inspect the Node with the debugger, I can see that SampleReceived is set to Node_SampleReceived. As far as I can tell it should work, it just refuses to.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/38, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR1MhUyNk4Nzm3a9--lCuHDj0C0KCks5slYzmgaJpZM4Phtd5.

PaulNoto commented 6 years ago

Thanks, I hope you can figure it out from your end. If not, I can always give you Remote Desktop access to the machine that is my development system.

PaulNoto commented 6 years ago

I tried a couple of things that had no effect.

I added 2 different Node_SampleReceived Handlers. My code won't call either of them, even though when I inspect the node they are both added to the SampleReceived invocation list. Your GetNetworkAsync code calls both of them.

In my code, I moved adding the Handler to just after Creating the Node, checking if it was the delay in adding the handler, no help.

In your code I added a 15 second callback timer to add the Node_SampleReceived Handler later than when the node is found by DiscoverNetworkAsync, creating a delay. Your code still works.

At this point, my thinking on basic trouble shooting gets me nowhere.

1 My code runs on your system but not on mine, then it could be something about how slow my development computer is, or the operating system.

ASROCK BeeBox with Celeron CPU N3000 @ 1.04GHz Win 10 PRO I always work under a Limited Account never as the Admin.

2 I really don't believe it's a hardware/OS issue because, when I inspect Node.SampleReceived I can see that the Handler has been added, and I think the Handler should be called, regardless of hardware/OS.

So it could be a difference between the way a Node is created automatically by DiscoverNetworkAsync vs. new XBeeNode in my code. Maybe something like, executing on a different thread. However, my code runs on your system, so it can't be that.

3 It could be a difference in the packages that are added to my project, causing the code on my machine to be different from yours.

However, I would think that NuGet would add the same packages.

And now I'm lost, again.

jefffhaynes commented 6 years ago

Ah, I inadvertently made a change to your code that was part of the problem but there was also another bug in my stuff (I think this is the real one but the two things conspired to make it work on my machine).

So part of the problem is that when you call GetXBeeAsync you are not awaiting the task. Therefore there is no guarantee that method will complete. This may also explain some of the debugger weirdness you are seeing. If you want to keep your current approach you need to make the Controller_SampleReceived handler async, change the return type for GetXBeeAsync from void to Task and await GetXBeeAsync. Although, I would consider simply subscribing to the node handler on discovery rather than the multi-pass approach. I think if you make that change and get the latest version it will work.

Anyway, this is the one ;)

PaulNoto commented 6 years ago

Yeah!!! It works. I was thinking about making changes to my multi-pass approach, that will allow me to remove one pass. However, I believe I have to use a multi-pass approach, to be able to find the sleeping nodes that don't show up when I call GetNetworkAsync. Anyway, I'm very grateful for the effort you put in, so that I can use NuGet to stay current with changes / features that you add. Speaking of NuGet, are you going to look into all those packages it is adding? My motivation is driven by the way I keep my Production system updated. I transfer the entire directory structure of my project, including config files, schematics, xbee setup files, etc., from my development system to the production system, across the internet. That way if I lose the development system, everything is backed up on the production system. This wasn't a big deal when the files added up to 300KB, now they are 300MB. If this is how it is going to be, I will have to start using a transfer program that will only move what has changed across the internet. Once again. Thank you, for all your help.

jefffhaynes commented 6 years ago

Awesome, glad to hear it. Do me a favor and submit a separate bug about the packages (if you haven’t already, I can’t remember) so I can track it. Thanks!


From: PaulNoto notifications@github.com Sent: Sunday, September 24, 2017 3:35:30 PM To: jefffhaynes/XBee Cc: Jeff Haynes; State change Subject: Re: [jefffhaynes/XBee] No change. Node_SampleReceived is still not being called (#38)

Yeah!!! It works. I was thinking about making changes to my multi-pass approach, that will allow me to remove one pass. However, I believe I have to use a multi-pass approach, to be able to find the sleeping nodes that don't show up when I call GetNetworkAsync. Anyway, I'm very grateful for the effort you put in, so that I can use NuGet to stay current with changes / features that you add. Speaking of NuGet, are you going to look into all those packages it is adding? My motivation is driven by the way I keep my Production system updated. I transfer the entire directory structure of my project, including config files, schematics, xbee setup files, etc., from my development system to the production system, across the internet. That way if I lose the development system, everything is backed up on the production system. This wasn't a big deal when the files added up to 300KB, now they are 300MB. If this is how it is going to be, I will have to start using a transfer program that will only move what has changed across the internet. Once again. Thank you, for all your help.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/38#issuecomment-331733715, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKRxODqytVtIzKgQpSt4A6m64PRFWXks5slq8DgaJpZM4Phtd5.