 			if (len == sizeof(pong)) {
 				memcpy(&pong, buf, sizeof(pong));
 
-				if (strcmp(pong.msg, "ping") == 0) {
+				if (pong.type == T_PING) {
 					// got ping
 					sprintf(line, "Recv PING(%d,%d,%d)", pong.count, pong.rssi, pong.initiator);
 					Serial.println(line);
 					// send pong
-					strcpy(pong.msg, "pong");
+					pong.type = T_PONG;
 					pong.rssi = rf95.lastRssi();
 					pong.replier = ping.initiator;
 					sprintf(line, "Send PONG(%d,%d,%d)", pong.count, pong.rssi, pong.replier);

#include <RH_RF95.h>

typedef struct {
	char msg[5];    // ping or pong
	int count;      // counter
	int rssi;       // signal strength
	int initiator, replier;
} pingpong_t;

// Singleton instance of the radio driver
static RH_RF95 rf95;
static pingpong_t ping;
static pingpong_t pong;

void setup() {
	Serial.begin(115200);

	rf95.setFrequency(869.525);
	rf95.setModemConfig(RH_RF95::Bw125Cr48Sf4096);

	int r;
	for(uint8_t i=A0; i<=A7; i++)
		r ^= analogRead(i);
	srandom(r);

	//    rf95.setTxPower(20);

	// init ping
	ping.type = T_PING;
	ping.count = 0;
	ping.rssi = 0;
	ping.initiator = 214; // FIXME CHANGE THIS TO SOMETHING UNIQUE
	pong.replier = -1;

	pong.initiator = -1;
