// brn: Short-circuits baud rate negotiation on West, and logs all
// other packets north (including those that would normally be handled
// by reflexes, e.g., 'P'rogramming packets).

// (If two IXM's running this sketch are connected together
// west-to-west, watch out!  You might think it's harmless -- since on
// the west this sketch 'never speaks unless spoken to' -- but if an S
// packet does manage to get sent between them (e.g., by deliberate
// 'R'outing), that will provoke a response of TWO S packets, which
// will provoke FOUR S packets, which will...)

void setup() {
  WestFace.begin(9600,false);   // Open west in conscious packet mode, 9600 8N1
}                               // (NORTH unmentioned, defaults to reflex packet mode)

void loop() { 
  u8 * packet = WestFace.readPacket(); // Check for packet from south

  if (!packet)                  // Nothing to deal with
    return;

  if (packet[0]=='S')           // Did we get a type 'S' packet?
    facePrintf(WEST,"S!\nSC\n"); // Yes, respond with S! and SC (two packets!)
  else                          // Otherwise log it to NORTH
    facePrintf(NORTH,"Ld '%#p'\n",packet); // Wrap it in a Log packet and send it NORTH
}
