gateway code for wsn