root/experimental/components/USRP_Ctrl_GUI/branches/0.6.2/USRP_Ctrl_GUI/main.cpp @ 4561

Revision 4561, 2.3 KB (checked in by DrewCormier, 7 years ago)

usrp commander seems much cooler than USRP_Ctrl

Line 
1/****************************************************************************
2
3Copyright 2007 Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE USRP_Commander.
6
7OSSIE USRP_Commander is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12OSSIE USRP_Commander is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OSSIE USRP_Commander; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23#include <iostream>
24
25#include "ossie/ossieSupport.h"
26#include "ossie/debug.h"
27
28#include "USRP_Commander.h"
29
30
31int main(int argc, char* argv[])
32
33{
34    ossieDebugLevel = 3;
35
36    ossieSupport::ORB *orb = new ossieSupport::ORB;
37    omni_mutex component_running_mutex;
38    omni_condition *component_running = new omni_condition(&component_running_mutex);
39
40    ossieSupport::ossieComponent usrp_commander(orb, argc, argv);
41
42    USRP_Commander_i* usrp_commander_servant;
43    CF::Resource_var usrp_commander_var;
44
45    // Create the usrp_commander component servant and object reference
46
47    usrp_commander_servant = new USRP_Commander_i(usrp_commander.getUuid(), component_running);
48    usrp_commander_var = usrp_commander_servant->_this();
49
50    PortableServer::ObjectId_var servantId = orb->poa->reference_to_id(usrp_commander_var);
51
52    usrp_commander.bind(usrp_commander_var);
53
54    // This bit is ORB specific
55    // omniorb is threaded and the servants are running at this point
56    // so we block on the condition
57    // The releaseObject method clear the condition and the component exits
58
59    component_running->wait();
60
61    usrp_commander.unbind();
62
63    DEBUG(4, USRP_Commander, "Deactivate object.");
64    orb->poa->deactivate_object(servantId);
65
66    DEBUG(4, USRP_Commander, "Destroy POA.");
67    orb->poa->destroy(false, false);
68
69    DEBUG(4, USRP_Commander, "Shutdown orb.");
70    orb->orb->shutdown(0);
71
72}
Note: See TracBrowser for help on using the browser.