Define: Gateway & Node ?

Started by bstott, August 11, 2013, 11:18:32 PM

bstott

I'm confused regarding what an avr gateway and node are. I understand for a network a gateway is a gateway from one network to another. A node in a simple network is an end device that either will act as a  server providing services or be a client to use services. Or can be a gateway to another network but, setup as a node on the initiating network. Or be sensors, etc....

With the Moteino being an Arduino clone with a radio attached it is one end of a communication connection with a sensor or other device attached. I can only see it as a node or kind of modem, serial device. This being in a node to node configuration.

What is the difference between Gateway & Node?   ???

? Is the gateway connected to a PC? This would make it a gateway for PC commands to go to a Node and for data from a Node to get into the PC. Yes?

If I create two devices not PC attached - one device to be acted on and the other to perform an action - would these both be Nodes or Gateways?


Felix

Gateway (master) usually is the main node that receives data from the nodes (slaves) and transmits it back to a host computer for further processing/storage.
The library functionality doesn't dictate a name or another, but I named the sketches what seemed more intuitive.

bstott


bstott

More Q's

In the Gateway and Node sketches the 'Blink' of pin 3 and 5 - These statements and the sub-routine 'Blink' is for testing and be deleted without hindering the radio?


Felix

Sure, you can delete the blinking, nothing to do with the radios. Just visual indication.

bstott

Noob coding Questions on Gateway and Node Examples.

Gateway:
1) Two lines --- "SPIFlash..." and "bool ..." are after the "RFM69 radio;" section but, not within the Node code. Would you explain the "RFM69 radio;" heading?
2) int vs byte? - In the line "byte ackCount=0;" It appears you are adding later on ackCount and the name indicates this also. Could "int" also be used? Isn't byte a place not a type? <terms ?>

Node:
1) Code placement - Is the "boolean request..." line similar to the "bool promis..." from the Gateway Example? to be placed under the "RFM69 radio;" in Node?

Cut-N-Paste for reference *******************************

Gateway
.
.
RFM69 radio;
SPIFlash flash(8, 0xEF30); //EF40 for 16mbit windbond chip
bool promiscuousMode = false; //set to 'true' to sniff all packets on the same network
.
.
byte ackCount=0;
void loop() {

Node
.
.
boolean requestACK = false;
SPIFlash flash(8, 0xEF30); //EF40 for 16mbit windbond chip
RFM69 radio;
.
.

Brian.

Felix

1) SPIFlash flash(...) and RFM69 radio; are instantiations of C++ classes. The variables flash and radio become instances of those classes. It's just basic object oriented c++
2) int takes 4 bytes of RAM, byte takes 1 byte of RAM, they are just utility/temporary variables to help me keep track of stuff in the program

And yes bool and boolean are the same thing. C++ has the ability to alias anything into anything else. So I could rename int into bluecheese if I wanted, or abbreviate it, or even alias it as integer if I like that better.