| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2005,2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE USRP Device. |
|---|
| 6 | |
|---|
| 7 | OSSIE USRP Device is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE USRP Device is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE USRP Device; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | ****************************************************************************/ |
|---|
| 23 | |
|---|
| 24 | #include <iostream> |
|---|
| 25 | |
|---|
| 26 | #include <sched.h> |
|---|
| 27 | |
|---|
| 28 | #include "ossie/ossieSupport.h" |
|---|
| 29 | #include "ossie/debug.h" |
|---|
| 30 | |
|---|
| 31 | #include "USRP.h" |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | int main(int argc, char* argv[]) |
|---|
| 35 | |
|---|
| 36 | { |
|---|
| 37 | |
|---|
| 38 | if (argc != 4) { |
|---|
| 39 | std::cerr << argv[0] << " <identifier> <usage name> <software profile>" << std::endl; |
|---|
| 40 | exit (-1); |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | ossieDebugLevel = 3; |
|---|
| 44 | |
|---|
| 45 | struct sched_param prio; |
|---|
| 46 | |
|---|
| 47 | prio.sched_priority = 5; |
|---|
| 48 | |
|---|
| 49 | int rc = sched_setscheduler(0, SCHED_RR, &prio); |
|---|
| 50 | |
|---|
| 51 | if (rc < 0) |
|---|
| 52 | std::cerr << "Failed to set RR scheduler for USRP device." << std::endl; |
|---|
| 53 | |
|---|
| 54 | ossieSupport::ORB *orb = new ossieSupport::ORB; |
|---|
| 55 | |
|---|
| 56 | char *id = argv[1]; |
|---|
| 57 | char *label = argv[2]; |
|---|
| 58 | char *profile = argv[3]; |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | USRP_i* usrp_servant; |
|---|
| 62 | CF::Device_var usrp_var; |
|---|
| 63 | |
|---|
| 64 | // Create the USRP device servant and object reference |
|---|
| 65 | |
|---|
| 66 | usrp_servant = new USRP_i(id, label, profile); |
|---|
| 67 | usrp_var = usrp_servant->_this(); |
|---|
| 68 | |
|---|
| 69 | std::string objName = "DomainName1/"; |
|---|
| 70 | objName += label; |
|---|
| 71 | orb->bind_object_to_name((CORBA::Object_ptr) usrp_var, objName.c_str()); |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | // Start the orb |
|---|
| 75 | orb->orb->run(); |
|---|
| 76 | |
|---|
| 77 | } |
|---|