COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
usrp_lib.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
30 
31 #ifndef USRP_LIB_H
32 #define USRP_LIB_H
33 
34 #include "support/configCosmos.h"
35 #include "support/socketlib.h"
36 #include "support/stringlib.h"
37 
38 #define USRP_BAUD 19200
39 #define USRP_BITS 8
40 #define USRP_PARITY 0
41 #define USRP_STOPBITS 1
42 
43 #define USRP_CHANNEL_A 0
44 #define USRP_CHANNEL_B 1
45 #define USRP_CHANNEL_SWAP 2
46 
47 #define USRP_DATAMODE_OFF 0
48 #define USRP_DATAMODE_ON 1
49 
50 #define USRP_9600MODE_OFF 0
51 #define USRP_9600MODE_ON 1
52 
53 #define USRP_MODE_LSB 0
54 #define USRP_MODE_USB 1
55 #define USRP_MODE_AM 2
56 #define USRP_MODE_CW 3
57 #define USRP_MODE_RTTY 4
58 #define USRP_MODE_FM 5
59 #define USRP_MODE_CWR 7
60 #define USRP_MODE_RTTYR 8
61 #define USRP_MODE_DV 17
62 
63 #define USRP_FILTER_1 1
64 #define USRP_FILTER_2 2
65 #define USRP_FILTER_3 3
66 
68 {
69  uint8_t record=0;
70  uint8_t channelnum;
72  uint16_t port;
73  std::mutex mut;
74  vector <uint8_t> response;
75  uint8_t freqband;
76  uint8_t filtband;
77  uint8_t mode;
78  uint8_t datamode;
79  uint8_t bps9600mode;
80  uint8_t rfgain;
81  uint8_t squelch;
82  uint8_t rfpower;
83  uint8_t smeter;
84  uint8_t rfmeter;
85  uint8_t swrmeter;
86  uint8_t alcmeter;
87  uint8_t compmeter;
88  uint8_t opmode;
89  float bandpass;
90  float powerin;
91  float powerout;
92  float maxpower;
93  double frequency;
94 };
95 
96 int32_t usrp_connect(string device, uint16_t port, usrp_handle &handle);
98 int32_t usrp_send(usrp_handle &handle, std::string &data);
99 uint8_t usrp_byte(vector <uint8_t> response);
100 uint8_t usrp_freq2band(double frequency);
101 //int32_t usrp_read(usrp_handle &handle, vector <uint8_t> &message);
103 int32_t usrp_set_channel(usrp_handle &handle, uint8_t channelnum);
106 int32_t usrp_set_freqband(usrp_handle &handle, uint8_t mode);
108 int32_t usrp_set_bandpass(usrp_handle &handle, double bandpass);
110 int32_t usrp_set_mode(usrp_handle &handle, uint8_t opmode);
111 int32_t usrp_set_mode(usrp_handle &handle, uint8_t opmode, uint8_t filtband);
113 int32_t usrp_set_rfgain(usrp_handle &handle, uint8_t rfgain);
115 int32_t usrp_set_rfpower(usrp_handle &handle, float power);
117 int32_t usrp_set_squelch(usrp_handle &handle, uint8_t squelch);
119 int32_t usrp_set_datamode(usrp_handle &handle, uint8_t mode);
121 int32_t usrp_set_bps9600mode(usrp_handle &handle, uint8_t mode);
129 int32_t usrp_set_record(usrp_handle &handle, uint8_t record);
130 
131 #endif // USRP_LIB_H
132 
uint8_t usrp_byte(vector< uint8_t > response)
Definition: usrp_lib.cpp:69
uint8_t alcmeter
Definition: usrp_lib.h:86
Definition: usrp_lib.h:67
uint8_t opmode
Definition: usrp_lib.h:88
uint16_t port
Definition: usrp_lib.h:72
uint8_t swrmeter
Definition: usrp_lib.h:85
int32_t usrp_get_bps9600mode(usrp_handle &handle)
uint8_t filtband
Definition: usrp_lib.h:76
int32_t usrp_get_squelch(usrp_handle &handle)
uint8_t mode
Definition: usrp_lib.h:77
uint8_t record
Definition: usrp_lib.h:69
uint8_t squelch
Definition: usrp_lib.h:81
int32_t usrp_set_channel(usrp_handle &handle, uint8_t channelnum)
int32_t usrp_get_smeter(usrp_handle &handle)
uint8_t rfgain
Definition: usrp_lib.h:80
int32_t usrp_set_record(usrp_handle &handle, uint8_t record)
Definition: usrp_lib.cpp:322
uint8_t freqband
Definition: usrp_lib.h:75
uint8_t channelnum
Definition: usrp_lib.h:70
int32_t usrp_check_address(usrp_handle &handle)
int32_t usrp_set_frequency(usrp_handle &handle, double frequency)
Definition: usrp_lib.cpp:226
int32_t usrp_get_freqband(usrp_handle &handle)
int32_t usrp_set_mode(usrp_handle &handle, uint8_t opmode)
int32_t usrp_set_freqband(usrp_handle &handle, uint8_t mode)
Definition: socketlib.h:115
Headers and definitions common to all COSMOS.
int32_t usrp_get_rfpower(usrp_handle &handle)
Socket Support header file.
socket_channel socket
Definition: usrp_lib.h:71
int32_t usrp_set_datamode(usrp_handle &handle, uint8_t mode)
uint8_t datamode
Definition: usrp_lib.h:78
int32_t usrp_set_squelch(usrp_handle &handle, uint8_t squelch)
int32_t usrp_send(usrp_handle &handle, std::string &data)
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
float maxpower
Definition: usrp_lib.h:92
double frequency
Definition: usrp_lib.h:93
int32_t usrp_get_compmeter(usrp_handle &handle)
int32_t usrp_get_record(usrp_handle &handle)
Definition: usrp_lib.cpp:306
int32_t usrp_connect(string device, uint16_t port, usrp_handle &handle)
Definition: usrp_lib.cpp:33
stringlib include file A library providing functions for handling various types of string...
int32_t usrp_set_bandpass(usrp_handle &handle, double bandpass)
int32_t usrp_disconnect(usrp_handle &handle)
Definition: usrp_lib.cpp:49
int32_t usrp_get_frequency(usrp_handle &handle)
Definition: usrp_lib.cpp:148
int32_t usrp_get_rfmeter(usrp_handle &handle)
int32_t usrp_get_bandpass(usrp_handle &handle)
uint8_t compmeter
Definition: usrp_lib.h:87
float powerin
Definition: usrp_lib.h:90
int32_t usrp_set_rfpower(usrp_handle &handle, float power)
int32_t usrp_set_rfgain(usrp_handle &handle, uint8_t rfgain)
int32_t usrp_get_datamode(usrp_handle &handle)
int32_t usrp_set_bps9600mode(usrp_handle &handle, uint8_t mode)
int32_t usrp_get_rfgain(usrp_handle &handle)
vector< uint8_t > response
Definition: usrp_lib.h:74
float bandpass
Definition: usrp_lib.h:89
uint8_t rfpower
Definition: usrp_lib.h:82
int32_t usrp_get_mode(usrp_handle &handle)
uint8_t usrp_freq2band(double frequency)
Definition: usrp_lib.cpp:81
std::mutex mut
Definition: usrp_lib.h:73
static string device
Definition: ax25_recv.cpp:39
uint8_t bps9600mode
Definition: usrp_lib.h:79
int32_t usrp_get_swrmeter(usrp_handle &handle)
uint8_t rfmeter
Definition: usrp_lib.h:84
int32_t usrp_get_alcmeter(usrp_handle &handle)
float powerout
Definition: usrp_lib.h:91
uint8_t smeter
Definition: usrp_lib.h:83