src/main.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003 Copyright 2005,2006 Virginia Polytechnic Institute and State University
00004 
00005 This file is part of the OSSIE USRP Device.
00006 
00007 OSSIE USRP Device is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 OSSIE USRP Device is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with OSSIE USRP Device; if not, write to the Free Software
00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021 
00022 ****************************************************************************/
00023 
00024 #include <iostream>
00025 #include <cstdlib>
00026 #include <sched.h>
00027 
00028 #include "ossie/ossieSupport.h"
00029 #include "ossie/debug.h"
00030 
00031 #include "USRP.h"
00032 
00033 
00034 int main(int argc, char* argv[])
00035 
00036 {
00037 
00038     if (argc != 4) {
00039         std::cerr << argv[0] << " <identifier> <usage name> <software profile>" << std::endl;
00040         exit (-1);
00041     }
00042 
00043     ossieDebugLevel = 3;
00044 
00045     struct sched_param prio;
00046 
00047     prio.sched_priority = 5;
00048 
00049     int rc = sched_setscheduler(0, SCHED_RR, &prio);
00050 
00051     if (rc < 0)
00052         std::cerr << "Failed to set RR scheduler for USRP device." << std::endl;
00053 
00054     ossieSupport::ORB *orb = new ossieSupport::ORB;
00055 
00056     char *id = argv[1];
00057     char *label = argv[2];
00058     char *profile = argv[3]; 
00059 
00060 
00061     USRP_i* usrp_servant;
00062     CF::Device_var usrp_var;
00063 
00064     // Create the USRP device servant and object reference
00065 
00066     usrp_servant = new USRP_i(id, label, profile);
00067     usrp_var = usrp_servant->_this();
00068 
00069     std::string objName = "DomainName1/";
00070     objName += label;
00071     orb->bind_object_to_name((CORBA::Object_ptr) usrp_var, objName.c_str());
00072 
00073 
00074     // Start the orb
00075     orb->orb->run();
00076 
00077 }

Generated on Thu Feb 12 04:00:39 2009 for USRP Device by  doxygen 1.5.4