arm studio build

Dependencies:   libxDot-mbed5

Files at this revision

API Documentation at this revision

Comitter:
alan1974
Date:
Thu Nov 07 18:30:54 2019 +0000
Parent:
23:148c9cd250d8
Child:
25:e89f944c85df
Commit message:
initial commit of 0.11 release

Changed in this revision

inc/commI2C.h Show annotated file Show diff for this revision Revisions of this file
inc/history.h Show annotated file Show diff for this revision Revisions of this file
src/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/inc/commI2C.h	Fri Aug 16 17:40:42 2019 +0000
+++ b/inc/commI2C.h	Thu Nov 07 18:30:54 2019 +0000
@@ -38,6 +38,7 @@
    XDOT_CMD_NVM,            // xdot nvm memory 
    XDOT_CMD_NVM_ABP,        // xdot nvm for multicast ABP creds
    XDOT_CMD_SET_RADIO_CLASS, // change radio class to A or C
+   XDOT_CMD_RESTORE_SESSION,// NEW: restore XDOT OTAA session  
    XDOT_CMD_UNDEFINED,      //last cmd, not used 
 };
 
--- a/inc/history.h	Fri Aug 16 17:40:42 2019 +0000
+++ b/inc/history.h	Thu Nov 07 18:30:54 2019 +0000
@@ -1,6 +1,7 @@
 #ifdef COMMENTS_ONLY
 xdot release notes: https://os.mbed.com/teams/MultiTech/wiki/Dot-library-change-log
 Data:       Rev:    API:    Comments:
+05Nov2019  000B    004      - save session parameters so that they can be restored by psoc after reboot to eliminate rejoins.
 13Aug2019  000A    004      - updated to libxDot 3.2.0 and mbed_os 5.11.1
                             - multitech deprecated api(s): setTxInverted,setRxInverted.. These have never been used and are now set to false.
                             - added api call dot->getNextTxMaxSize() to check if next transmit contains mac data, if so only xmit mac data,
--- a/src/main.cpp	Fri Aug 16 17:40:42 2019 +0000
+++ b/src/main.cpp	Thu Nov 07 18:30:54 2019 +0000
@@ -34,7 +34,7 @@
 //api_level: proc code will not run if api level (last two bytess) greater than what it expects
 //=======================================================================================================
 uint8_t api_level[4] = { 0x00, 0x00, 0x00, 0x04 };  //api-level, determines if xdot code works with proc code
-uint8_t ver_level[4] = { 0x00, 0x00, 0x00, 0x0A };  //updated for every code check-in
+uint8_t ver_level[4] = { 0x00, 0x00, 0x00, 0x0B };  //updated for every code check-in
 
 //=======================================================================================================
 //configuring mbed pinsa; https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/io/DigitalInOut/
@@ -337,9 +337,11 @@
                             if(verbose)pc.printf("\r\n----------- NETWORK NOT JOINED YET, WILL TRY TO JOIN %d TIMES\r\n",pUp->joinAttemps);                                                            
                             joined = join_network_wbit(pUp->joinAttemps);      //try joinAttemps times to join network
                             pAck->joinAttempts = join_network_attempts_wbit(); //# of join attemps made
-                            //pAck->mdot_ret = dot->send(upstream_packet);  //<--------------------------------------- extra xmit ???????????????
-                            save_OTAA_session_keys();
-                            if (!joined)                        
+                            if (joined){                                       //are we now joined?
+                                dot->saveNetworkSession();  //save OTAA keys and session info on new join success
+                                save_OTAA_session_keys();   //used for multicast
+                            }   
+                            else
                                if(verbose)pc.printf("\r\n----------- FAILED TO JOIN...GIVING UP\r\n");  // join network if not joined                                                                                 }         
                         }                               
                         if (joined)                             //we are joined to the network                            
@@ -498,6 +500,18 @@
                             pDwnNvm->bChkSumOK = 1;    
                         printNmvData(&pDwnNvm->nvmData);    
                         break;  
+                    case XDOT_CMD_RESTORE_SESSION:  //restore OTAA session
+                        dot->restoreNetworkSession();
+                        dot->setDownLinkCounter(0); //reset frame counters
+                        dot->setUpLinkCounter(0);
+                        pkt_ntwrk  *pDwnRstSession = (pkt_ntwrk*)&buf_xmt[0];                                                 
+                        pDwnRstSession->ack = I2C_ACK_PROC;
+                        pDwnRstSession->cmd = XDOT_CMD_RESTORE_SESSION;
+                        pDwnRstSession->bSetNetwrk = 1;
+                        pDwnRstSession->dataLen = sizeof(pkt_ntwrk)-2;                                                
+                        if(verbose)pc.printf("\n\r OTAA network session restored\r\n");    
+                        wait_ms(I2C_MIN_WAIT_DELAY);                                                 
+                        break;                        
                     case XDOT_CMD_SET_RADIO_CLASS:  //multicast_change_class A or C (change only after a join!)                      
                         if(verbose)pc.printf("\n\r proc cmd: change radio class\r\n");                                  
                         pkt_setClassUp  *pUpSetClass =  (pkt_setClassUp*)&buf_rcv[0];