Index: /vtcross/branches/sriram/dsa.py
===================================================================
--- /vtcross/branches/sriram/dsa.py	(revision 380)
+++ /vtcross/branches/sriram/dsa.py	(revision 381)
@@ -39,4 +39,5 @@
 
 	def rx_callback(ok, payload):
+		print "inside rx callback\n"
 		global n_rcvd, n_right,sync_status,mode,ch,traffic_flag
     		##############################################################
@@ -61,4 +62,6 @@
 	       				ack_payload = struct.pack('!HsH', pktno & 0xffff,data,ch & 0xffff) #+ data
 		      			send_pkt(tb,ack_payload) #sending back the acknowledgement
+			else:
+				print "sync packet not ok\n"
 		##############################################################
     		
@@ -74,4 +77,11 @@
 					payload = struct.pack('!15s', data)
 					send_pkt(tb,payload)
+				
+				#(data_header,) = struct.unpack('!s', payload[0])
+				#if data_header == 'd':
+				#	comm = struct.unpack('!14s', payload[1:15])
+				#	print("received this ", comm) 
+			else:
+				print "data packet not ok\n"
 		##############################################################
 
@@ -256,5 +266,5 @@
 		################################################Communications mode#################################
 		if mode == "traffic":
-			print "Inside traffic mode"
+				print "Inside traffic mode"
 			if check_sync == 0:
 				time.sleep(0.8)
@@ -265,38 +275,38 @@
 					check_sync = 1	
 
-				nbytes = 15
-    	    			pkt_size = 15
-				data_pktno = 0
-				n = 0
-				while n < nbytes:
-                			#print >> myfile, "inside while"
-               				if options_tx.from_file is None:
-                 				#data = (pkt_size - 2) * chr(data_pktno & 0xff) #0xff is 255
-                				data = 'dHi how are you' #Sending this message
-	        				#print >> myfile, data
-                				#print "printing data",data,"****\n"
-                			else:
-            		    			data = source_file.read(pkt_size - 2)
-            		    			if data == '':
-                	        			break;
+			nbytes = 15
+    	    		pkt_size = 15
+			data_pktno = 0
+			n = 0
+			while n < nbytes:
+                		#print >> myfile, "inside while"
+               			if options_tx.from_file is None:
+                 			#data = (pkt_size - 2) * chr(data_pktno & 0xff) #0xff is 255
+                			data = 'dHi how are you' #Sending this message
+	        			#print >> myfile, data
+                			#print "printing data",data,"****\n"
+                		else:
+            		    		data = source_file.read(pkt_size - 2)
+            		    		if data == '':
+                	        		break;
 	
 			
-                			payload = struct.pack('!15s', data)
-	       				#print "printing payload",payload,"**\n"
+                		payload = struct.pack('!15s', data)
+	       			#print "printing payload",payload,"**\n"
 				
-                			send_pkt(tb,payload)
-					#print "printing payload",payload,"**\n"
-                			n += len(payload)
-                			sys.stderr.write('.')
-                			if options_tx.discontinuous and data_pktno % 5 == 4:
-                				time.sleep(1)
-                			data_pktno += 1
-	    				#print "before sleeping for 10 seconds and value of resend count is",resend_count
-					time.sleep(0.2)
-					ch_energy = tb.rxpath.probe.level() #check if primary user is present
-					print "channel energy is ",ch_energy,"\n"
-            				if int(ch_energy) > 2e7: #if primary user is there then dont transmit on this channel
-						mode = "sync"
-                	
+                		send_pkt(tb,payload)
+				print "printing payload",data,"**\n"
+                		n += len(payload)
+                		sys.stderr.write('.')
+                		if options_tx.discontinuous and data_pktno % 5 == 4:
+                			time.sleep(1)
+                		data_pktno += 1
+	    			#print "before sleeping for 10 seconds and value of resend count is",resend_count
+				time.sleep(0.2)
+				ch_energy = tb.rxpath.probe.level() #check if primary user is present
+				print "channel energy is ",ch_energy,"\n"
+            			if int(ch_energy) > 2e7: #if primary user is there then dont transmit on this channel
+					mode = "sync"
+                
 
 
