Changeset 435

Show
Ignore:
Timestamp:
08/25/09 13:35:50 (15 years ago)
Author:
bhilburn
Message:

Now outputting socketFD in of registered components in logs, returning
proper data type to support different platforms.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/shell/CognitiveRadioShell.cpp

    r433 r435  
    116116CognitiveRadioShell::Shutdown() 
    117117{ 
    118     // TODO should something else be happening here? 
     118    LOG("Shutting down Cognitive Radio Shell.\n"); 
    119119} 
    120120 
     
    127127 
    128128 
    129 // TODO what is the point of always returning a 1? 
    130129bool 
    131130CognitiveRadioShell::SendRadioConfiguration(int32_t socketFD) 
     
    189188    if(strcmp(buffer, "receive_config_ack") != 0) { 
    190189        LOG("Cognitive Radio Shell:: Unexpected response: %s\n", buffer); 
    191         return 0; 
    192     } 
    193  
    194     return 1; 
     190        return false; 
     191    } 
     192 
     193    return true; 
    195194} 
    196195 
     
    204203 
    205204    sprintf(numberExpString, "%d", numberExp); 
    206     SendMessage(socketFD, "test");  //TODO modified 
     205    SendMessage(socketFD, "test"); 
    207206 
    208207    char buffer[256]; 
     
    210209    ReadMessage(socketFD, buffer); 
    211210    if(strcmp(buffer, "receive_exp_ack") != 0) { 
    212         // TODO perhaps this should be a WARNING instead of a LOG? 
    213         LOG("Cognitive Radio Shell:: Unexpected response: %s\n", buffer); 
    214         return 0; 
    215     } 
    216     //printf("done sending exp \n"); 
    217     return 1; 
     211        WARNING("Cognitive Radio Shell:: Unexpected response: %s\n", buffer); 
     212        return false; 
     213    } 
     214    return true; 
    218215} 
    219216 
     
    222219CognitiveRadioShell::RegisterCognitiveEngine(int32_t socketFD) 
    223220{ 
    224     LOG("Cognitive Radio Shell:: Received registration message from Cognitive Engine.\n"); 
     221    LOG("Cognitive Radio Shell:: Received registration from Cognitive Engine on socket %d.\n" \ 
     222            socketFD); 
    225223    
    226224    SendMessage(socketFD, "register_ack"); 
     
    229227 
    230228    numberOfCognitiveEngines++; 
     229     
     230    /* More efficient to always set to true than add a conditional branch to the 
     231     * code. */ 
    231232    CE_present = true; 
    232233} 
     
    245246    shutdown(socketFD, 2); 
    246247    close(socketFD); 
    247     LOG("Cognitive Radio Shell:: Socket closed.\n"); 
     248    LOG("Cognitive Radio Shell:: Socket %d closed.\n", socketFD); 
    248249} 
    249250 
     
    252253CognitiveRadioShell::RegisterPolicyEngine(int32_t socketFD) 
    253254{ 
    254     LOG("Cognitive Radio Shell:: Received registration message from Policy Engine.\n"); 
     255    LOG("Cognitive Radio Shell:: Received registration from Policy Engine on socket %d.\n", \ 
     256            socketFD); 
     257 
    255258    PE_present = true; 
    256259} 
     
    267270    shutdown(socketFD, 2); 
    268271    close(socketFD); 
    269     LOG("Cognitive Radio Shell:: Socket closed.\n"); 
     272    LOG("Cognitive Radio Shell:: Socket %d closed.\n", socketFD); 
    270273} 
    271274 
     
    274277CognitiveRadioShell::RegisterSML(int32_t socketFD) 
    275278{ 
    276     LOG("Cognitive Radio Shell:: Received registration message from SML.\n"); 
     279    LOG("Cognitive Radio Shell:: Received registration from SML on socket %d.\n", \ 
     280            socketFD); 
    277281 
    278282    SML_present = true; 
     
    290294    shutdown(socketFD, 2); 
    291295    close(socketFD); 
    292     LOG("Cognitive Radio Shell:: Socket closed.\n"); 
     296    LOG("Cognitive Radio Shell:: Socket %d closed.\n", socketFD); 
    293297} 
    294298