[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/tos/lib/RovingNetworks RovingNetworksM.nc, 1.8, 1.9

steve ayer ayer1 at users.sourceforge.net
Mon Jun 30 07:22:31 PDT 2008


Update of /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/tos/lib/RovingNetworks
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13154

Modified Files:
	RovingNetworksM.nc 
Log Message:

valuable code update from adrian burns, quoted here:

"This change saves current while NOT connected.

Added setPagingTime() and setInquiryTime() commands to save power when
Bluetooth module is NOT connected. SNIFF mode saves power when
connected.

Old default idle current was ~25ma (SI,0200 & SJ,0200) , the new
optimised default idle current is ~9ma (SI,0040 & SJ,0080)."


Index: RovingNetworksM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/tos/lib/RovingNetworks/RovingNetworksM.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RovingNetworksM.nc	10 Apr 2008 14:24:15 -0000	1.8
--- RovingNetworksM.nc	30 Jun 2008 14:22:29 -0000	1.9
***************
*** 57,63 ****
    uint8_t radioMode, charsSent, setupStep;
    bool discoverable, authenticate, encrypt, setNameRequest, setPINRequest, runDiscoveryRequest, resetDefaultsRequest,
!     setSvcClassRequest, setDevClassRequest, setSvcNameRequest, setCustomBaudrate, disableRemoteConfig, newMode;
    norace bool transmissionOverflow, messageInProgress;
!   char expectedCommandResponse[8], newName[17], newPIN[17], newSvcClass[5], newDevClass[5], newSvcName[17], newBaudrate[5];
    
    norace struct Message * outgoingMsg;
--- 57,65 ----
    uint8_t radioMode, charsSent, setupStep;
    bool discoverable, authenticate, encrypt, setNameRequest, setPINRequest, runDiscoveryRequest, resetDefaultsRequest,
!     setSvcClassRequest, setDevClassRequest, setSvcNameRequest, setCustomBaudrate, disableRemoteConfig, newMode,
!     setCustomInquiryTime, setCustomPagingTime;
    norace bool transmissionOverflow, messageInProgress;
!   char expectedCommandResponse[8], newName[17], newPIN[17], newSvcClass[5], newDevClass[5], newSvcName[17], newBaudrate[5],
!     newInquiryTime[5], newPagingTime[5];
    
    norace struct Message * outgoingMsg;
***************
*** 203,206 ****
--- 205,230 ----
    }    
  
+   /* 
+    * Sets the Inquiry Scan Window - amount of time device 
+    * spends enabling inquiry scan (discoverability).
+    * Minimum = (hex word) "0012", corresponding to about 1% duty cycle.
+    * Maximum = (hex word) "1000"
+    */
+   command void Bluetooth.setInquiryTime(char * hexval_time){
+     setCustomInquiryTime = TRUE;
+     snprintf(newInquiryTime, 5, "%s", hexval_time);
+   }    
+ 
+   /* 
+    * Sets the Paging Scan Window - amount of time device 
+    * spends enabling page scan (connectability).
+    * Minimum = (hex word) "0012", corresponding to about 1% duty cycle.
+    * Maximum = (hex word) "1000"
+    */
+   command void Bluetooth.setPagingTime(char * hexval_time){
+     setCustomPagingTime = TRUE;
+     snprintf(newPagingTime, 5, "%s", hexval_time);
+   }    
+ 
    /*
     * this one is weird.  we need to do one at a time; the only way
***************
*** 240,244 ****
         */
        if(!discoverable){
! 	writeCommand("SI,0x0000\r", "AOK");
  	break;
        }
--- 264,268 ----
         */
        if(!discoverable){
! 	writeCommand("SI,0000\r", "AOK");
  	break;
        }
***************
*** 298,302 ****
        if(setCustomBaudrate){
          // set the baudrate to suit the MSP430 running at 8Mhz
! 	sprintf(commandbuf, "SZ,%s\r", newBaudrate);
          writeCommand(commandbuf, "AOK");
          break;
--- 322,326 ----
        if(setCustomBaudrate){
          // set the baudrate to suit the MSP430 running at 8Mhz
!         sprintf(commandbuf, "SZ,%s\r", newBaudrate);
          writeCommand(commandbuf, "AOK");
          break;
***************
*** 315,318 ****
--- 339,364 ----
      case 13:
        setupStep++;
+       if(setCustomInquiryTime){
+         sprintf(commandbuf, "SI,%s\r", newInquiryTime);
+         writeCommand(commandbuf, "AOK");
+       }
+       else{
+         // to save power only leave inquiry on for approx 40msec (every 1.28 secs)
+         writeCommand("SI,0040\r", "AOK");
+       }
+       break;
+     case 14:
+       setupStep++;
+       if(setCustomPagingTime){
+         sprintf(commandbuf, "SJ,%s\r", newPagingTime);
+         writeCommand(commandbuf, "AOK");
+       }
+       else{
+         // to save power only leave paging on for approx 80msec (every 1.28 secs)
+         writeCommand("SJ,0080\r", "AOK");
+       }
+       break;
+     case 15:
+       setupStep++;
        // exit command mode
        writeCommand("---\r", "END");
***************
*** 344,348 ****
      setCustomBaudrate = FALSE;
      disableRemoteConfig = FALSE;
! 
      setupStep = 0;
      atomic *expectedCommandResponse = NULL;
--- 390,396 ----
      setCustomBaudrate = FALSE;
      disableRemoteConfig = FALSE;
!     setCustomInquiryTime = FALSE;
!     setCustomPagingTime = FALSE;
!     
      setupStep = 0;
      atomic *expectedCommandResponse = NULL;



More information about the Tinyos-contrib-commits mailing list