 
     //Acknowledge RFSwitch command by publishing the same message 
     Publish(STR_RFSWITCH_STATUS, JsonACK, false);
-  } 
+  }
+
 }
 
 //Fill array with split topic elements

#include <JsonParser.h>
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
#include <VirtualWire.h>
#include <x10.h>

  return client.publish(getString(STR_GATEWAY_RAM), (uint8_t*)mem, strlen(mem), true);
}

//Check Magic packet in UDP, soft reset if kill command found
void checkUDP() {

  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  
  if(packetSize) {    
    char contents = Udp.read();    
    // send a reply, to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
    
    if (contents == 'K') {

      Udp.write('1');      
      Udp.endPacket();

      #if DEBUG            
        Serial << "RESETTING..." << endl;
      #endif
      
      //Software Reset
      software_Reset();

    } else {

      Udp.write('0');
      Udp.endPacket();
    }        
  }
}

// Restarts program from beginning but does not reset the peripherals and registers
void software_Reset() {
  asm volatile ("  jmp 0");
}

//Return size of PROGMEM variable
// byte size(prog_uchar *var) {
//   return sizeof(var)-1;
