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

XBeeNode.SampleReceived Handler not called. Continued #36

Closed
PaulNoto opened this issue Sep 10, 2017 · 16 comments
Closed

XBeeNode.SampleReceived Handler not called. Continued #36

PaulNoto opened this issue Sep 10, 2017 · 16 comments

Comments

@PaulNoto
Copy link

Hope you don't mind, I wanted to start a fresh Issue, because the other one had gotten to lengthy.

Anyway, my way of initializing the XBeeNode.SampleReceived handler still doesn't work. However, I made a test, adapting your DiscoverNetwork example and it works.

I did find 2 Issues:

#1) args.Name is missing the first character of the Name for all nodes found.

#2) DiscoverNetworkAsync does not discover Sleeping Nodes, which is to be expected because they are asleep. That is why I developed a reactive system that adds nodes when they send a sample for the first time.

Now I'm back to my original problem. I remember you said you tried my code on your machine and it worked. I am lost at this point. You just suggested that it might be a difference in the way we are creating nodes, but you ran my code on your system and it was calling the Node_SampleReceived Handler.

Anyway, I have made something that does work, and it is always good to know that everything can work. However, it won't work for what I need, because of the sleeping nodes. Any suggestions would be greatly appreciated.
Thanks, Paul.


THIS CODE WORKS to call the Node_SampleReceived Handler

using System;
using System.Windows;
using XBee;

namespace WpfApp2 {
///


/// Interaction logic for MainWindow.xaml
///

public partial class MainWindow : Window {
private XBeeController controller = null;

	public MainWindow() {
		InitializeComponent();
		controller = new XBeeController();

		controller.NodeDiscovered += NodeDiscovered;

		Await_DiscoverController();
	}

	//----------------------------------------------------------

	private async void Await_DiscoverController() {
		try {
			await controller.OpenAsync( "COM3", 115200 );
			// NOTE: DiscoverNetworkAsync does not discover Sleeping Nodes  < < < < < < < < < < < <
			await controller.DiscoverNetworkAsync();
		}
		catch ( Exception e ) {
			string s = e.Message;
		}
	}

	//----------------------------------------------------------

	private void NodeDiscovered( object sender, NodeDiscoveredEventArgs args ) {
	// NOTE: args.Name is missing the first character of the Name for all nodes found  < < < < < < < < < < < <
	string s = args.Name;
		if ( args.Node.Address.LongAddress.Value == 0x0013A20040F4F731 ) {
			args.Node.SampleReceived += Node_SampleReceived;
		}
	}

	//---------------------------------------------------------------------------

	private int _sampleReceived_Cntr = 0;
	private void Node_SampleReceived( object sender, SampleReceivedEventArgs e ) {
		_sampleReceived_Cntr++;
	}



}

}

@jefffhaynes
Copy link
Owner

jefffhaynes commented Sep 10, 2017 via email

@PaulNoto
Copy link
Author

Sorry, I misunderstood.

I assume you mean the profile.xml files.
When I try to add them here, I get an error of: We don't support that file type.
Is there another way to export from XCTU or another way to attach these xml files?

@PaulNoto
Copy link
Author

PaulNoto commented Sep 10, 2017 via email

@PaulNoto
Copy link
Author

Just found out I could reply to your email with them attached.

@PaulNoto
Copy link
Author

Did they come through on the email reply?

@jefffhaynes
Copy link
Owner

jefffhaynes commented Sep 10, 2017 via email

@PaulNoto
Copy link
Author

Hmm... Let me look in to that.

@PaulNoto
Copy link
Author

Haven't used onedrive since it was skydrive, here goes:

https://1drv.ms/f/s!ArPDpRHDMgzfehRpy01XdthK3uo

That should be a link to the files. Let me know if it works.

@jefffhaynes
Copy link
Owner

jefffhaynes commented Sep 10, 2017 via email

@PaulNoto
Copy link
Author

Thanks I appreciate all the help.
Remember, there is no rush. I am using your old code that works perfect. I just need this so I don't remain trapped in the past, and can't access new features.
Thanks,
Paul

@jefffhaynes
Copy link
Owner

I tried loading both. Coordinator, no problem. For some reason the router config is putting the node into a state where I can't talk to it (locally) and I have to do a forced recovery on it. Have you seen this?

I also realized that I only have one S2C module so I may have to order a second one before I can reproduce this. I don't mind but obviously it'll be a few days...

@PaulNoto
Copy link
Author

OOPS! I sent you the Router config off the xbee network, after my software had changed the DIN pin to an output. I just added the unchanged profile to one drive as profile_Router_2.xml. Does the link above still work to be able to get at it.

@jefffhaynes
Copy link
Owner

No worries. No, the folder just has the coord config now.

@PaulNoto
Copy link
Author

@jefffhaynes
Copy link
Owner

Yup, that works but I am going to need more nodes to reproduce. I ordered them so hopefully it won't take too long.

@jefffhaynes
Copy link
Owner

Found it! Try 1.5.4

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

2 participants