COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
agent_radio.cpp File Reference

Agent Radio for Satellite Ground Station. More...

Include dependency graph for agent_radio.cpp:

Functions

int32_t request_enable (string &request, string &response, Agent *)
 
int32_t request_disable (string &request, string &response, Agent *)
 
int32_t request_get_state (string &request, string &response, Agent *)
 
int32_t request_get_bandpass (string &request, string &response, Agent *)
 
int32_t request_get_frequency (string &request, string &response, Agent *)
 
int32_t request_get_opmode (string &request, string &response, Agent *)
 
int32_t request_get_modulation (string &request, string &response, Agent *)
 
int32_t request_get_powerin (string &request, string &response, Agent *)
 
int32_t request_get_powerout (string &request, string &response, Agent *)
 
int32_t request_get_repeater_squelch (string &request, string &response, Agent *)
 
int32_t request_set_bandpass (string &request, string &response, Agent *)
 
int32_t request_set_frequency (string &request, string &response, Agent *)
 
int32_t request_set_opmode (string &request, string &response, Agent *)
 
int32_t request_set_modulation (string &request, string &response, Agent *)
 
int32_t request_set_maxpower (string &request, string &response, Agent *)
 
int32_t request_set_offset (string &request, string &response, Agent *)
 
int32_t request_set_moreoffset (string &request, string &response, Agent *)
 
int32_t request_set_repeater_squelch (string &request, string &response, Agent *)
 
int32_t request_set_record (string &request, string &response, Agent *)
 
int32_t connect_radio ()
 
int32_t disconnect_radio ()
 
string opmode2string (uint16_t opmode)
 
string modulation2string (uint16_t modulation)
 
uint16_t string2modulation (string name)
 
int main (int argc, char *argv[])
 

Variables

static Agentagent
 
static std::string nodename =""
 
static std::string radioname
 
static size_t deviceindex
 
static size_t radioindex = 9999
 
static std::string radiodevice
 
static uint16_t radioaddr
 
static bool radioconnected = false
 
static bool radioenabled = false
 
static float freqoffset = 0.
 
static float morefreqoffset = 0.
 
static string port
 
static uint16_t model
 
static uint16_t radiotype = static_cast<uint16_t>(DeviceType::NONE)
 
static float freq
 
static float band
 
static uint8_t opmode = static_cast<uint8_t>(DEVICE_RADIO_MODE_UNDEF)
 
static ic9100_handle ic9100
 
static usrp_handle usrp
 
static uint8_t target_record
 
static tcvstruc target
 
static tcvstruc actual
 
static tcvstruc initial
 
static bool initialized = false
 
static int32_t lasterrorcode
 
static char lasterrormessage [300]
 

Detailed Description

Agent Radio for Satellite Ground Station.

This is the main agent that controls the ground station. It it the channel for the T&C and it is also responsible for the Agent Antenna and Agent Radio

Function Documentation

int32_t request_enable ( string &  request,
string &  response,
Agent  
)
703 {
704  radioenabled = true;
705  return 0;
706 }
static bool radioenabled
Definition: agent_radio.cpp:162
int32_t request_disable ( string &  request,
string &  response,
Agent  
)
709 {
710  radioenabled = false;
711  return 0;
712 }
static bool radioenabled
Definition: agent_radio.cpp:162
int32_t request_get_state ( string &  request,
string &  response,
Agent  
)
715 {
716  char buff[512];
717  sprintf(buff,"[%.6f] Cx: %u En: %u Mode: %s TFreq: %.0f AFreq: %.0f Offset: %.0f PowerIn: %.2f PowerOut: %.2f MaxPower: %.2f",
718  currentmjd(),
720  radioenabled,
721  opmode2string(agent->cinfo->device[deviceindex].tcv.opmode).c_str(),
722  target.freq, agent->cinfo->device[deviceindex].tcv.freq,
723  freqoffset,
724  agent->cinfo->device[deviceindex].tcv.powerin,
725  agent->cinfo->device[deviceindex].tcv.powerout,
726  agent->cinfo->device[deviceindex].tcv.maxpower);
727  response = string(buff);
728  return (0);
729 }
static tcvstruc target
Definition: agent_radio.cpp:180
static float freqoffset
Definition: agent_radio.cpp:164
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static bool radioconnected
Definition: agent_radio.cpp:161
double freq
Input Frequency.
Definition: jsondef.h:2510
static bool radioenabled
Definition: agent_radio.cpp:162
static Agent * agent
Definition: agent_radio.cpp:154
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
string opmode2string(uint16_t opmode)
Definition: agent_radio.cpp:1104
int32_t request_get_bandpass ( string &  request,
string &  response,
Agent  
)
760 {
761  response = std::to_string(agent->cinfo->device[deviceindex].tcv.band);
762  return 0;
763 }
string to_string(char *value)
Definition: stringlib.cpp:220
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_get_frequency ( string &  request,
string &  response,
Agent  
)
732 {
733  response = std::to_string(agent->cinfo->device[deviceindex].tcv.freq);
734  return 0;
735 }
string to_string(char *value)
Definition: stringlib.cpp:220
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_get_opmode ( string &  request,
string &  response,
Agent  
)
804 {
805  response = ( opmode2string(agent->cinfo->device[deviceindex].tcv.opmode).c_str());
806  return 0;
807 }
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
string opmode2string(uint16_t opmode)
Definition: agent_radio.cpp:1104
int32_t request_get_modulation ( string &  request,
string &  response,
Agent  
)
906 {
907  response = (modulation2string(agent->cinfo->device[deviceindex].tcv.modulation).c_str());
908  return 0;
909 }
string modulation2string(uint16_t modulation)
Definition: agent_radio.cpp:1155
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_get_powerin ( string &  request,
string &  response,
Agent  
)
774 {
775  response = std::to_string(agent->cinfo->device[deviceindex].tcv.powerin);
776  return 0;
777 }
string to_string(char *value)
Definition: stringlib.cpp:220
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_get_powerout ( string &  request,
string &  response,
Agent  
)
780 {
781  response = std::to_string(agent->cinfo->device[deviceindex].tcv.powerout);
782  return 0;
783 }
string to_string(char *value)
Definition: stringlib.cpp:220
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_get_repeater_squelch ( string &  request,
string &  response,
Agent  
)
746 {
747  response = std::to_string(agent->cinfo->device[deviceindex].tcv.squelch_tone);
748  return 0;
749 }
string to_string(char *value)
Definition: stringlib.cpp:220
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static Agent * agent
Definition: agent_radio.cpp:154
static size_t deviceindex
Definition: agent_radio.cpp:157
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_set_bandpass ( string &  request,
string &  response,
Agent  
)
766 {
767  int32_t iretn = 0;
768 
769  sscanf(request.c_str(), "%*s %f", &target.band);
770  return iretn;
771 }
static tcvstruc target
Definition: agent_radio.cpp:180
int iretn
Definition: rw_test.cpp:37
float band
Input Filter bandpass.
Definition: jsondef.h:2522
int32_t request_set_frequency ( string &  request,
string &  response,
Agent  
)
738 {
739  // int32_t iretn;
740 
741  sscanf(request.c_str(), "%*s %lf", &target.freq);
742  return 0;
743 }
static tcvstruc target
Definition: agent_radio.cpp:180
double freq
Input Frequency.
Definition: jsondef.h:2510
int32_t request_set_opmode ( string &  request,
string &  response,
Agent  
)
810 {
811  char mode[20];
812  sscanf(request.c_str(), "%*s %s", mode);
813  switch (mode[strlen(mode)-1])
814  {
815  case '0':
816  case '1':
817  case '2':
818  case '3':
819  case '4':
820  case '5':
821  case '6':
822  case '7':
823  case '8':
824  case '9':
825  target.opmode = atol(mode);
826  break;
827  case 'r':
828  case 'R':
829  switch(mode[0])
830  {
831  case 'c':
832  case 'C':
834  break;
835  case 'r':
836  case 'R':
838  break;
839  }
840  break;
841  case 'd':
842  case 'D':
843  switch(mode[0])
844  {
845  case 'a':
846  case 'A':
848  break;
849  case 'd':
850  case 'D':
852  break;
853  case 'f':
854  case 'F':
856  break;
857  case 'l':
858  case 'L':
860  break;
861  case 'u':
862  case 'U':
864  break;
865  }
866  break;
867  default:
868  switch(mode[0])
869  {
870  case 'a':
871  case 'A':
873  break;
874  case 'c':
875  case 'C':
877  break;
878  case 'd':
879  case 'D':
881  break;
882  case 'f':
883  case 'F':
885  break;
886  case 'l':
887  case 'L':
889  break;
890  case 'r':
891  case 'R':
893  break;
894  case 'u':
895  case 'U':
897  break;
898  }
899  break;
900  }
901 
902  return 0;
903 }
Definition: jsondef.h:575
uint16_t opmode
Operating mode.
Definition: jsondef.h:2502
Definition: jsondef.h:585
Definition: jsondef.h:584
static tcvstruc target
Definition: agent_radio.cpp:180
Definition: jsondef.h:581
Definition: jsondef.h:574
Definition: jsondef.h:576
Definition: jsondef.h:579
Definition: jsondef.h:572
Definition: jsondef.h:583
Definition: jsondef.h:580
Definition: jsondef.h:582
Definition: jsondef.h:573
Definition: jsondef.h:578
Definition: jsondef.h:577
int32_t request_set_modulation ( string &  request,
string &  response,
Agent  
)
912 {
913  char mode[20];
914  sscanf(request.c_str(), "%*s %s", mode);
916 
917  return 0;
918 }
uint16_t modulation
Data modulation.
Definition: jsondef.h:2504
static tcvstruc target
Definition: agent_radio.cpp:180
uint16_t string2modulation(string name)
Definition: agent_radio.cpp:1194
int32_t request_set_maxpower ( string &  request,
string &  response,
Agent  
)
786 {
787  sscanf(request.c_str(), "%*s %f", &target.maxpower);
788  return 0;
789 }
static tcvstruc target
Definition: agent_radio.cpp:180
float maxpower
Output Power limit.
Definition: jsondef.h:2520
int32_t request_set_offset ( string &  request,
string &  response,
Agent  
)
792 {
793  sscanf(request.c_str(), "%*s %f", &freqoffset);
794  return 0;
795 }
static float freqoffset
Definition: agent_radio.cpp:164
int32_t request_set_moreoffset ( string &  request,
string &  response,
Agent  
)
798 {
799  sscanf(request.c_str(), "%*s %f", &morefreqoffset);
800  return 0;
801 }
static float morefreqoffset
Definition: agent_radio.cpp:165
int32_t request_set_repeater_squelch ( string &  request,
string &  response,
Agent  
)
752 {
753  // int32_t iretn;
754 
755  sscanf(request.c_str(), "%*s %f", &target.squelch_tone);
756  return 0;
757 }
static tcvstruc target
Definition: agent_radio.cpp:180
float squelch_tone
repeater squelch tone frequency
Definition: jsondef.h:2524
int32_t request_set_record ( string &  request,
string &  response,
Agent  
)
921 {
922  sscanf(request.c_str(), "%*s %hhu", &target_record);
923 
924  return 0;
925 }
static uint8_t target_record
Definition: agent_radio.cpp:179
int32_t connect_radio ( )
928 {
929  int32_t iretn;
930  radioconnected = false;
931 
932  switch (agent->cinfo->device[deviceindex].model)
933  {
934  case DEVICE_MODEL_USRP:
935  if (usrp.socket.cudp != 0)
936  {
938  }
940  if (iretn < 0)
941  {
942  sprintf(lasterrormessage, "Unable to connect to USRP: %d", iretn);
944  return iretn;
945  }
946  if (!initialized)
947  {
948  initialized = true;
949  iretn = usrp_get_frequency(usrp);
950  if (iretn >= 0)
951  {
953  }
954  actual = initial;
955  target = actual;
956  }
957  break;
959  {
960  if (!initialized)
961  {
962  initialized = true;
963  initial = actual;
964  }
965  radioconnected = true;
966  }
967  break;
970 // if (iretn < 0)
971 // {
972 // sprintf(lasterrormessage, "Unable to connect to Astrodev: %d", iretn);
973 // lasterrorcode = iretn;
974 // return iretn;
975 // }
976 
977 // if (!initialized)
978 // {
979 // initialized = true;
980 // iretn = ic9100_get_frequency(ic9100);
981 // if (iretn >= 0)
982 // {
983 // initial.freq = ic9100.frequency;
984 // }
985 // iretn = ic9100_get_mode(ic9100);
986 // if (iretn >= 0)
987 // {
988 // initial.opmode = ic9100.opmode;
989 // }
990 // iretn = ic9100_get_bandpass(ic9100);
991 // if (iretn >= 0)
992 // {
993 // initial.band = ic9100.bandpass;
994 // }
995 // actual = initial;
996 // target = actual;
997 // }
998  break;
999  case DEVICE_MODEL_IC9100:
1001  if (iretn < 0)
1002  {
1003  sprintf(lasterrormessage, "Unable to connect to IC9100: %d", iretn);
1004  lasterrorcode = iretn;
1005  return iretn;
1006  }
1007  iretn = ic9100_set_channel(ic9100, 0);
1008  if (iretn < 0)
1009  {
1010  sprintf(lasterrormessage, "Unable to set IC9100 to Main: %d", iretn);
1011  lasterrorcode = iretn;
1012  return iretn;
1013  }
1014 
1015  if (!initialized)
1016  {
1017  initialized = true;
1018  iretn = ic9100_get_frequency(ic9100);
1019  if (iretn >= 0)
1020  {
1022  }
1023  iretn = ic9100_get_mode(ic9100);
1024  if (iretn >= 0)
1025  {
1027  }
1028  iretn = ic9100_get_bandpass(ic9100);
1029  if (iretn >= 0)
1030  {
1032  }
1033  actual = initial;
1034  target = actual;
1035  }
1036  break;
1037  case DEVICE_MODEL_TS2000:
1038  break;
1039  default:
1040  sprintf(lasterrormessage, "Unknow radio model: %d", agent->cinfo->device[deviceindex].model);
1042  return GENERAL_ERROR_UNDEFINED;
1043  break;
1044  }
1045 
1046  radioconnected = true;
1047  return 0;
1048 }
Definition: jsondef.h:561
uint16_t opmode
Operating mode.
Definition: jsondef.h:2502
int32_t ic9100_set_channel(ic9100_handle &handle, uint8_t channelnum)
Definition: ic9100_lib.cpp:1089
static tcvstruc target
Definition: agent_radio.cpp:180
int32_t socket_close(socket_channel *channel)
Close socket.
Definition: socketlib.cpp:509
static tcvstruc initial
Definition: agent_radio.cpp:182
int iretn
Definition: rw_test.cpp:37
static int32_t lasterrorcode
Definition: agent_radio.cpp:185
Definition: jsondef.h:567
uint8_t opmode
Definition: ic9100_lib.h:86
static bool initialized
Definition: agent_radio.cpp:183
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static tcvstruc actual
Definition: agent_radio.cpp:181
int32_t ic9100_get_frequency(ic9100_handle &handle)
Definition: ic9100_lib.cpp:778
int32_t ic9100_connect(string device, uint8_t address, ic9100_handle &handle)
Definition: ic9100_lib.cpp:33
static bool radioconnected
Definition: agent_radio.cpp:161
static char lasterrormessage[300]
Definition: agent_radio.cpp:186
double freq
Input Frequency.
Definition: jsondef.h:2510
int32_t cudp
Definition: socketlib.h:120
int32_t ic9100_get_bandpass(ic9100_handle &handle)
Definition: ic9100_lib.cpp:510
static uint16_t radioaddr
Definition: agent_radio.cpp:160
static Agent * agent
Definition: agent_radio.cpp:154
int32_t usrp_get_frequency(usrp_handle &handle)
Definition: usrp_lib.cpp:148
socket_channel socket
Definition: usrp_lib.h:71
float band
Input Filter bandpass.
Definition: jsondef.h:2522
static usrp_handle usrp
Definition: agent_radio.cpp:177
double frequency
Definition: usrp_lib.h:93
static ic9100_handle ic9100
Definition: agent_radio.cpp:176
int32_t usrp_connect(string device, uint16_t port, usrp_handle &handle)
Definition: usrp_lib.cpp:33
static size_t deviceindex
Definition: agent_radio.cpp:157
float bandpass
Definition: ic9100_lib.h:87
int32_t ic9100_get_mode(ic9100_handle &handle)
Definition: ic9100_lib.cpp:810
#define GENERAL_ERROR_UNDEFINED
Definition: cosmos-errno.h:295
cosmosstruc * cinfo
Definition: agentclass.h:346
double frequency
Definition: ic9100_lib.h:92
Definition: jsondef.h:560
Definition: jsondef.h:565
static std::string radiodevice
Definition: agent_radio.cpp:159
Definition: jsondef.h:562
int32_t disconnect_radio ( )
1051 {
1052  int32_t iretn = 0;
1053 
1054  if (initialized)
1055  {
1056  switch (agent->cinfo->device[deviceindex].model)
1057  {
1058  case DEVICE_MODEL_LOOPBACK:
1059  {
1060  actual = initial;
1061  }
1062  break;
1063  case DEVICE_MODEL_ASTRODEV:
1064  break;
1065  case DEVICE_MODEL_IC9100:
1067  if (iretn < 0)
1068  {
1069  sprintf(lasterrormessage, "Unable to set IC9100 frequency to %f: %d", target.freq, iretn);
1070  lasterrorcode = iretn;
1071  }
1073  if (iretn < 0)
1074  {
1075  sprintf(lasterrormessage, "Unable to set IC9100 squelch tone to %f: %d", target.squelch_tone, iretn);
1076  lasterrorcode = iretn;
1077  }
1079  if (iretn < 0)
1080  {
1081  sprintf(lasterrormessage, "Unable to set IC9100 to %s: %d", opmode2string(target.opmode).c_str(), iretn);
1082  lasterrorcode = iretn;
1083  }
1085  if (iretn < 0)
1086  {
1087  sprintf(lasterrormessage, "Unable to set IC9100 bandpass to %f: %d", target.band, iretn);
1088  lasterrorcode = iretn;
1089  }
1090  break;
1091  case DEVICE_MODEL_TS2000:
1092  break;
1093  default:
1094  sprintf(lasterrormessage, "Unknow radio model: %d", agent->cinfo->device[deviceindex].model);
1096  iretn = GENERAL_ERROR_UNDEFINED;
1097  break;
1098  }
1099  }
1100 
1101  return iretn;
1102 }
Definition: jsondef.h:561
uint16_t opmode
Operating mode.
Definition: jsondef.h:2502
int32_t ic9100_set_repeater_squelch(ic9100_handle &handle, float frequency)
Definition: ic9100_lib.cpp:1499
int32_t ic9100_set_frequency(ic9100_handle &handle, double frequency)
Definition: ic9100_lib.cpp:868
static tcvstruc target
Definition: agent_radio.cpp:180
static tcvstruc initial
Definition: agent_radio.cpp:182
int iretn
Definition: rw_test.cpp:37
static int32_t lasterrorcode
Definition: agent_radio.cpp:185
static bool initialized
Definition: agent_radio.cpp:183
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static tcvstruc actual
Definition: agent_radio.cpp:181
static char lasterrormessage[300]
Definition: agent_radio.cpp:186
double freq
Input Frequency.
Definition: jsondef.h:2510
static Agent * agent
Definition: agent_radio.cpp:154
float squelch_tone
repeater squelch tone frequency
Definition: jsondef.h:2524
float band
Input Filter bandpass.
Definition: jsondef.h:2522
int32_t ic9100_set_mode(ic9100_handle &handle, uint8_t opmode)
Definition: ic9100_lib.cpp:974
int32_t ic9100_set_bandpass(ic9100_handle &handle, double bandpass)
Definition: ic9100_lib.cpp:362
static ic9100_handle ic9100
Definition: agent_radio.cpp:176
static size_t deviceindex
Definition: agent_radio.cpp:157
#define GENERAL_ERROR_UNDEFINED
Definition: cosmos-errno.h:295
cosmosstruc * cinfo
Definition: agentclass.h:346
string opmode2string(uint16_t opmode)
Definition: agent_radio.cpp:1104
Definition: jsondef.h:560
Definition: jsondef.h:565
Definition: jsondef.h:562
string opmode2string ( uint16_t  opmode)
1105 {
1106  std::string result;
1107  switch (opmode)
1108  {
1109  case DEVICE_RADIO_MODE_AM:
1110  result = "AM";
1111  break;
1112  case DEVICE_RADIO_MODE_AMD:
1113  result = "AM Data";
1114  break;
1115  case DEVICE_RADIO_MODE_FM:
1116  result = "FM";
1117  break;
1118  case DEVICE_RADIO_MODE_FMD:
1119  result = "FM Data";
1120  break;
1121  case DEVICE_RADIO_MODE_LSB:
1122  result = "LSB";
1123  break;
1125  result = "LSB Data";
1126  break;
1127  case DEVICE_RADIO_MODE_USB:
1128  result = "USB";
1129  break;
1131  result = "USB Data";
1132  break;
1134  result = "RTTY";
1135  break;
1137  result = "RTTYR";
1138  break;
1139  case DEVICE_RADIO_MODE_DV:
1140  result = "DV";
1141  break;
1142  case DEVICE_RADIO_MODE_DVD:
1143  result = "DV Data";
1144  break;
1145  case DEVICE_RADIO_MODE_CWR:
1146  result = "CWR";
1147  break;
1148  case DEVICE_RADIO_MODE_CW:
1149  result = "CW";
1150  break;
1151  }
1152  return result;
1153 }
Definition: jsondef.h:575
Definition: jsondef.h:585
Definition: jsondef.h:584
Definition: jsondef.h:581
Definition: jsondef.h:574
Definition: jsondef.h:576
Definition: jsondef.h:579
static uint8_t opmode
Definition: agent_radio.cpp:172
Definition: jsondef.h:572
Definition: jsondef.h:583
Definition: jsondef.h:580
Definition: jsondef.h:582
Definition: jsondef.h:573
Definition: jsondef.h:578
Definition: jsondef.h:577
string modulation2string ( uint16_t  modulation)
1156 {
1157  std::string result;
1158  switch (modulation)
1159  {
1161  result = "ASK";
1162  break;
1164  result = "BPSK1200";
1165  break;
1167  result = "BPSK2400";
1168  break;
1170  result = "BPSK4800";
1171  break;
1173  result = "BPSK9600";
1174  break;
1176  result = "AFSK";
1177  break;
1179  result = "GFSK1200";
1180  break;
1182  result = "GFSK2400";
1183  break;
1185  result = "GFSK4800";
1186  break;
1188  result = "GFSK9600";
1189  break;
1190  }
1191  return result;
1192 }
Definition: jsondef.h:599
Definition: jsondef.h:592
Definition: jsondef.h:591
Definition: jsondef.h:598
Definition: jsondef.h:595
Definition: jsondef.h:590
Definition: jsondef.h:596
Definition: jsondef.h:594
Definition: jsondef.h:597
Definition: jsondef.h:593
uint16_t string2modulation ( string  name)
1195 {
1196  uint16_t modulation = DEVICE_RADIO_MODULATION_UNDEF;
1197 
1198  if (name == "ask" || name == "ASK")
1199  {
1200  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_ASK);
1201  }
1202  else if (name == "bpsk1200" || name == "BPSK1200")
1203  {
1204  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_BPSK1200);
1205  }
1206  else if (name == "bpsk2400" || name == "BPSK2400")
1207  {
1208  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_BPSK2400);
1209  }
1210  else if (name == "bpsk4800" || name == "BPSK4800")
1211  {
1212  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_BPSK4800);
1213  }
1214  else if (name == "bpsk9600" || name == "BPSK9600")
1215  {
1216  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_BPSK9600);
1217  }
1218  else if (name == "afsk" || name == "AFSK")
1219  {
1220  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_AFSK);
1221  }
1222  else if (name == "gfsk1200" || name == "GFSK1200")
1223  {
1224  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_GFSK1200);
1225  }
1226  else if (name == "gfsk2400" || name == "GFSK2400")
1227  {
1228  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_GFSK2400);
1229  }
1230  else if (name == "gfsk4800" || name == "GFSK4800")
1231  {
1232  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_GFSK4800);
1233  }
1234  else if (name == "gfsk9600" || name == "GFSK9600")
1235  {
1236  modulation = static_cast<uint16_t>(DEVICE_RADIO_MODULATION_GFSK9600);
1237  }
1238 
1239  return modulation;
1240 }
Definition: jsondef.h:599
Definition: jsondef.h:592
Definition: jsondef.h:591
Definition: jsondef.h:598
Definition: jsondef.h:595
string name
Definition: cubesat2obj.cpp:6
Definition: jsondef.h:600
Definition: jsondef.h:590
Definition: jsondef.h:596
Definition: jsondef.h:594
Definition: jsondef.h:597
Definition: jsondef.h:593
int main ( int  argc,
char *  argv[] 
)
215 {
216  int32_t iretn;
217 
218  switch (argc)
219  {
220  case 9:
221  if (static_cast<string>("ic9100") == argv[3])
222  {
223  model = static_cast<uint16_t>(DEVICE_MODEL_IC9100);
224  port = argv[8];
225  radioaddr = stoi(port.substr(port.find(':')+1));
226  port = port.substr(0, port.find(':'));
227  }
228  else if (static_cast<string>("astrodev") == argv[3])
229  {
230  model = static_cast<uint16_t>(DEVICE_MODEL_ASTRODEV);
231  port = argv[8];
232  }
233  else if (static_cast<string>("ic9100") == argv[3])
234  {
235  model = static_cast<uint16_t>(DEVICE_MODEL_USRP);
236  port = argv[8];
237  radioaddr = stoi(port.substr(port.find(':')+1));
238  port = port.substr(0, port.find(':'));
239  }
240  else if (static_cast<string>("ic9100") == argv[3])
241  {
242  model = static_cast<uint16_t>(DEVICE_MODEL_DIRECT);
243  }
244 
245  if (static_cast<string>("txr") == argv[4])
246  {
247  radiotype = static_cast<uint16_t>(DeviceType::TXR);
248  }
249  else if (static_cast<string>("rxr") == argv[4])
250  {
251  radiotype = static_cast<uint16_t>(DeviceType::RXR);
252  }
253  else if (static_cast<string>("tcv") == argv[4])
254  {
255  radiotype = static_cast<uint16_t>(DeviceType::TCV);
256  }
257  freq = atof(argv[5]);
258  band = atof(argv[6]);
259  if (static_cast<string>("am") == argv[7])
260  {
261  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_AM);
262  }
263  else if (static_cast<string>("amd") == argv[7])
264  {
265  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_AMD);
266  }
267  else if (static_cast<string>("fm") == argv[7])
268  {
269  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_FM);
270  }
271  else if (static_cast<string>("fmd") == argv[7])
272  {
273  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_FMD);
274  }
275  else if (static_cast<string>("lsb") == argv[7])
276  {
277  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_LSB);
278  }
279  else if (static_cast<string>("lsbd") == argv[7])
280  {
281  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_LSBD);
282  }
283  else if (static_cast<string>("usb") == argv[7])
284  {
285  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_USB);
286  }
287  else if (static_cast<string>("usbd") == argv[7])
288  {
289  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_USBD);
290  }
291  else if (static_cast<string>("dv") == argv[7])
292  {
293  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_DV);
294  }
295  else if (static_cast<string>("dvd") == argv[7])
296  {
297  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_DVD);
298  }
299  else if (static_cast<string>("cw") == argv[7])
300  {
301  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_CW);
302  }
303  else if (static_cast<string>("cwr") == argv[7])
304  {
305  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_CWR);
306  }
307  else if (static_cast<string>("rtty") == argv[7])
308  {
309  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_RTTY);
310  }
311  else if (static_cast<string>("rttyr") == argv[7])
312  {
313  opmode = static_cast<uint16_t>(DEVICE_RADIO_MODE_RTTYR);
314  }
315  case 3:
316  nodename = argv[2];
317  case 2:
318  radioname = argv[1];
319  break;
320  default:
321  printf("Usage: agent->radio radioname [nodename [ic9100/astrodev/usrp txr/rxr/tcv frequency bandwidth mode device:addr]]");
322  exit (1);
323  }
324 
325  // Establish the command channel and heartbeat
326  if (!(agent = new Agent(nodename, radioname)))
327  {
328  std::cout << radioname << ": agent->setup_server failed (returned <"<<AGENT_ERROR_JSON_CREATE<<">)"<<std::endl;
330  }
331  else
332  {
333  std::cout<<"Starting " << radioname << " for Node: " << nodename << std::endl;
334  }
335 
336  if (argc > 3)
337  {
338  switch (radiotype)
339  {
340  case static_cast<uint16_t>(DeviceType::TXR):
342  deviceindex = agent->cinfo->pieces[static_cast <uint16_t>(iretn)].cidx;
344  agent->cinfo->device[deviceindex].txr.freq = freq;
345  agent->cinfo->device[deviceindex].txr.band = band;
346  agent->cinfo->device[deviceindex].txr.opmode = opmode;
347  break;
348  case static_cast<uint16_t>(DeviceType::RXR):
350  deviceindex = agent->cinfo->pieces[static_cast <uint16_t>(iretn)].cidx;
352  agent->cinfo->device[deviceindex].rxr.freq = freq;
353  agent->cinfo->device[deviceindex].rxr.band = band;
354  agent->cinfo->device[deviceindex].rxr.opmode = opmode;
355  break;
356  case static_cast<uint16_t>(DeviceType::TCV):
358  deviceindex = agent->cinfo->pieces[static_cast <uint16_t>(iretn)].cidx;
360  agent->cinfo->device[deviceindex].tcv.freq = freq;
361  agent->cinfo->device[deviceindex].tcv.band = band;
362  agent->cinfo->device[deviceindex].tcv.opmode = opmode;
363  break;
364  }
365  agent->cinfo->device[deviceindex].model = model;
367  agent->cinfo->device[deviceindex].tcv.freq = freq;
368  agent->cinfo->device[deviceindex].tcv.band = band;
369  agent->cinfo->device[deviceindex].tcv.opmode = opmode;
370 
371  if (model == static_cast<uint16_t>(DEVICE_MODEL_IC9100))
372  {
375  if (iretn >= 0)
376  {
377  agent->cinfo->device[deviceindex].portidx = iretn;
378  }
379  }
380  else if (model == static_cast<uint16_t>(DEVICE_MODEL_TS2000))
381  {
383  if (iretn >= 0)
384  {
385  agent->cinfo->device[deviceindex].portidx = iretn;
386  }
387  }
388  else if (model == static_cast<uint16_t>(DEVICE_MODEL_USRP))
389  {
392  if (iretn >= 0)
393  {
394  agent->cinfo->device[deviceindex].portidx = iretn;
395  }
396  }
397  else if (model == static_cast<uint16_t>(DEVICE_MODEL_DIRECT))
398  {
401  if (iretn >= 0)
402  {
403  agent->cinfo->device[deviceindex].portidx = iretn;
404  }
405  }
406  }
407 
408  // Add requests
409  if ((iretn=agent->add_request("enable",request_enable,"", "Enable active control of the radio frequency")))
410  exit (iretn);
411  if ((iretn=agent->add_request("disable",request_disable,"", "Disable active control of the radio frequency")))
412  exit (iretn);
413  if ((iretn=agent->add_request("get_state",request_get_state,"", "returns the radio frequency")))
414  exit (iretn);
415  if ((iretn=agent->add_request("get_frequency",request_get_frequency,"", "returns the radio frequency")))
416  exit (iretn);
417  if ((iretn=agent->add_request("get_bandpass",request_get_bandpass,"", "returns the radio filter bandpass")))
418  exit (iretn);
419  if ((iretn=agent->add_request("get_opmode",request_get_opmode,"", "returns the radio mode")))
420  exit (iretn);
421  if ((iretn=agent->add_request("get_modulation",request_get_modulation,"", "returns the radio mode")))
422  exit (iretn);
423  if ((iretn=agent->add_request("get_powerin",request_get_powerin,"", "returns the current RX radio power")))
424  exit (iretn);
425  if ((iretn=agent->add_request("get_powerout",request_get_powerout,"", "returns the current TX radio power")))
426  exit (iretn);
427  if ((iretn=agent->add_request("set_frequency",request_set_frequency,"Hz", "sets the radio frequency")))
428  exit (iretn);
429  if ((iretn=agent->add_request("set_bandpass",request_set_bandpass,"Hz", "sets the radio filter bandpass")))
430  exit (iretn);
431  if ((iretn=agent->add_request("set_opmode",request_set_opmode,"{am, amd, fm, fmd, dv, dvd, cw, cwr}", "sets the radio operating mode")))
432  exit (iretn);
433  if ((iretn=agent->add_request("set_modulation",request_set_modulation,"{ask, bpsk1200, bpsk2400, bpsk4800, bpsk9600, afsk, gfsk1200, gfsk2400, gfsk4800, gfsk9600}", "sets the radio modulation")))
434  exit (iretn);
435  if ((iretn=agent->add_request("set_power",request_set_maxpower,"watts", "sets the maximum TX radio power")))
436  exit (iretn);
437  if ((iretn=agent->add_request("set_offset",request_set_offset,"Hz", "sets the radio frequency offset")))
438  exit (iretn);
439  if ((iretn=agent->add_request("set_moreoffset",request_set_moreoffset,"Hz", "sets the radio frequency offset")))
440  exit (iretn);
441  if ((iretn=agent->add_request("set_repeater_squelch",request_set_repeater_squelch,"frequency", "sets the repeater squelch tone frequency (0. = off)")))
442  exit (iretn);
443  if ((iretn=agent->add_request("get_repeater_squelch",request_get_repeater_squelch,"", "gets the repeater squelch tone frequency (0. = off)")))
444  exit (iretn);
445  if ((iretn=agent->add_request("set_record",request_set_record,"0|1", "Turn recording off or on")))
446  exit (iretn);
447 
448 
449  // Look for named radio so we can use the right one
450  if (radiotype == static_cast<uint16_t>(DeviceType::NONE))
451  {
452  for (size_t i=0; i<agent->cinfo->devspec.rxr_cnt; ++i)
453  {
454  if (!strcmp(radioname.c_str(), agent->cinfo->pieces[agent->cinfo->device[agent->cinfo->devspec.rxr[i]].pidx].name))
455  {
457  radioindex = i;
458  radiotype = static_cast<uint16_t>(DeviceType::RXR);
459  break;
460  }
461  }
462  }
463 
464  if (radiotype == static_cast<uint16_t>(DeviceType::NONE))
465  {
466  for (size_t i=0; i<agent->cinfo->devspec.txr_cnt; ++i)
467  {
468  if (!strcmp(radioname.c_str(), agent->cinfo->pieces[agent->cinfo->device[agent->cinfo->devspec.txr[i]].pidx].name))
469  {
471  radioindex = i;
472  radiotype = static_cast<uint16_t>(DeviceType::TXR);
473  break;
474  }
475  }
476  }
477 
478  if (radiotype == static_cast<uint16_t>(DeviceType::NONE))
479  {
480  for (size_t i=0; i<agent->cinfo->devspec.tcv_cnt; ++i)
481  {
482  if (!strcmp(radioname.c_str(), agent->cinfo->pieces[agent->cinfo->device[agent->cinfo->devspec.tcv[i]].pidx].name))
483  {
485  radioindex = i;
486  radiotype = static_cast<uint16_t>(DeviceType::TCV);
487  break;
488  }
489  }
490  }
491 
492  if (radiotype == static_cast<uint16_t>(DeviceType::NONE))
493  {
494  std::cout<<"Exiting " << radioname << " for Node: " << nodename << " no radio found." << std::endl;
495  agent->shutdown();
496  exit (1);
497  }
498 
499  // Set SOH string
500  char sohstring[200];
501  switch (radiotype)
502  {
503  case static_cast<uint16_t>(DeviceType::TXR):
504  sprintf(sohstring, "{\"device_txr_freq_%03lu\",\"device_txr_maxpower_%03lu\",\"device_txr_power_%03lu\",\"device_txr_opmode_%03lu\",\"device_txr_modulation_%03lu\"}", radioindex, radioindex, radioindex, radioindex, radioindex);
505  break;
506  case static_cast<uint16_t>(DeviceType::RXR):
507  sprintf(sohstring, "{\"device_rxr_freq_%03lu\",\"device_rxr_power_%03lu\",\"device_rxr_band_%03lu\",\"device_rxr_opmode_%03lu\",\"device_rxr_modulation_%03lu\"}", radioindex, radioindex, radioindex, radioindex, radioindex);
508  break;
509  case static_cast<uint16_t>(DeviceType::TCV):
510  sprintf(sohstring, "{\"device_tcv_freq_%03lu\",\"device_tcv_powerin_%03lu\",\"device_tcv_powerout_%03lu\",\"device_tcv_maxpower_%03lu\",\"device_tcv_band_%03lu\",\"device_tcv_opmode_%03lu\",\"device_tcv_modulation_%03lu\"}", radioindex, radioindex, radioindex, radioindex, radioindex, radioindex, radioindex);
511  break;
512  }
513  agent->set_sohstring(sohstring);
514 
515  radiodevice = agent->cinfo->port[agent->cinfo->device[deviceindex].portidx].name;
517 
518  // Initialize values so connect_radio will work
521 
522  iretn = connect_radio();
523 
524  agent->cinfo->agent[0].aprd = 1.;
526  while (agent->running())
527  {
528  if (radioconnected)
529  {
530  switch (agent->cinfo->device[deviceindex].model)
531  {
532  case DEVICE_MODEL_DIRECT:
533  break;
534  case DEVICE_MODEL_USRP:
535  iretn = usrp_get_frequency(usrp);
536  if (iretn >= 0)
537  {
538  agent->cinfo->device[deviceindex].tcv.freq = usrp.frequency;
540  {
542  }
543  }
544  else
545  {
546  radioconnected = false;
547  }
548 
549  iretn = usrp_get_record(usrp);
550  if (iretn >= 0)
551  {
553  {
555  }
556  }
557 
558  break;
560  {
562  if (radioenabled && target.freq != actual.freq)
563  {
565  }
566  agent->cinfo->device[deviceindex].tcv.band = actual.band;
567  if (radioenabled && target.band != actual.band)
568  {
570  }
572  agent->cinfo->device[deviceindex].tcv.opmode = actual.opmode;
573  agent->cinfo->device[deviceindex].tcv.modulation = actual.opmode;
575  {
578  }
579  }
580  break;
582  break;
583  case DEVICE_MODEL_IC9100:
584  iretn = ic9100_get_frequency(ic9100);
585  if (iretn >= 0)
586  {
588  /*
589  if (ic9100_freq2band(target.freq) != ic9100.freqband)
590  {
591  iretn = ic9100_set_channel(ic9100, IC9100_CHANNEL_SWAP);
592  iretn = ic9100_get_frequency(ic9100);
593  }
594 */
596  {
598  }
599  }
600  else
601  {
602  radioconnected = false;
603  }
604 
605  iretn = ic9100_get_bandpass(ic9100);
606  if (iretn >= 0)
607  {
610  {
612  }
613  }
614  else
615  {
616  radioconnected = false;
617  }
618 
619  iretn = ic9100_get_mode(ic9100);
620  if (iretn >= 0)
621  {
622  agent->cinfo->device[deviceindex].tcv.opmode = ic9100.opmode;
624  {
626  }
627  }
628  else
629  {
630  radioconnected = false;
631  }
632 
634  if (iretn >= 0)
635  {
636  agent->cinfo->device[deviceindex].tcv.squelch_tone = ic9100.repeater_squelch;
638  {
640  }
641  }
642  else
643  {
644  radioconnected = false;
645  }
646 
647  iretn = ic9100_get_rfpower(ic9100);
648  if (iretn >= 0)
649  {
650  agent->cinfo->device[deviceindex].txr.maxpower = ic9100.maxpower;
651  // if (radioenabled && target.maxpower != ic9100.maxpower)
652  // {
653  // iretn = ic9100_set_rfpower(ic9100, target.maxpower);
654  // }
655  }
656  else
657  {
658  radioconnected = false;
659  }
660 
661  iretn = ic9100_get_smeter(ic9100);
662  if (iretn >= 0)
663  {
664  agent->cinfo->device[deviceindex].tcv.powerin = ic9100.powerin;
665  }
666  else
667  {
668  radioconnected = false;
669  }
670 
671  iretn = ic9100_get_rfmeter(ic9100);
672  if (iretn >= 0)
673  {
674  agent->cinfo->device[deviceindex].tcv.powerout = ic9100.powerout;
675  }
676  else
677  {
678  radioconnected = false;
679  }
680  break;
681  case DEVICE_MODEL_TS2000:
682  break;
683  }
684 
686  }
687  else
688  {
689  iretn = connect_radio();
690  if (iretn < 0)
691  {
693  }
694  }
695  }
696 
698 
699  agent->shutdown();
700 }
int32_t request_set_repeater_squelch(string &request, string &response, Agent *)
Definition: agent_radio.cpp:751
Radio Receiver.
Definition: jsondef.h:508
float powerout
Definition: ic9100_lib.h:89
Definition: jsondef.h:575
Definition: jsondef.h:650
Definition: jsondef.h:561
vector< portstruc > port
Vector of all ports known to node.
Definition: jsondef.h:4244
int32_t finish_active_loop()
Definition: agentclass.cpp:355
static size_t radioindex
Definition: agent_radio.cpp:158
int32_t request_get_state(string &request, string &response, Agent *)
Definition: agent_radio.cpp:714
static float freq
Definition: agent_radio.cpp:170
uint16_t opmode
Operating mode.
Definition: jsondef.h:2502
Definition: jsondef.h:585
static uint8_t target_record
Definition: agent_radio.cpp:179
int32_t ic9100_set_repeater_squelch(ic9100_handle &handle, float frequency)
Definition: ic9100_lib.cpp:1499
static string port
Definition: agent_radio.cpp:166
int32_t ic9100_set_frequency(ic9100_handle &handle, double frequency)
Definition: ic9100_lib.cpp:868
Definition: jsondef.h:584
int32_t request_get_powerout(string &request, string &response, Agent *)
Definition: agent_radio.cpp:779
uint16_t modulation
Data modulation.
Definition: jsondef.h:2504
vector< uint16_t > rxr
Definition: jsondef.h:3914
int i
Definition: rw_test.cpp:37
static tcvstruc target
Definition: agent_radio.cpp:180
Definition: jsondef.h:581
int32_t ic9100_get_repeater_squelch(ic9100_handle &handle)
Definition: ic9100_lib.cpp:1551
int32_t usrp_set_frequency(usrp_handle &handle, double frequency)
Definition: usrp_lib.cpp:226
uint8_t record
Definition: usrp_lib.h:69
Not a Component.
Definition: jsondef.h:556
Definition: jsondef.h:574
int iretn
Definition: rw_test.cpp:37
Definition: jsondef.h:576
static std::string nodename
Definition: agent_radio.cpp:155
uint16_t tcv_cnt
Definition: jsondef.h:3888
Definition: jsondef.h:567
Definition: jsondef.h:579
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
static uint8_t opmode
Definition: agent_radio.cpp:172
float maxpower
Definition: ic9100_lib.h:90
uint8_t opmode
Definition: ic9100_lib.h:86
vector< uint16_t > txr
Definition: jsondef.h:3925
static float band
Definition: agent_radio.cpp:171
static float freqoffset
Definition: agent_radio.cpp:164
int32_t request_set_moreoffset(string &request, string &response, Agent *)
Definition: agent_radio.cpp:797
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
static tcvstruc actual
Definition: agent_radio.cpp:181
int32_t ic9100_get_frequency(ic9100_handle &handle)
Definition: ic9100_lib.cpp:778
uint16_t running()
Check if we&#39;re supposed to be running.
Definition: agentclass.cpp:391
Definition: jsondef.h:651
static string sohstring
Definition: agent_cpu-2-0.cpp:72
Definition: jsondef.h:572
int32_t connect_radio()
Definition: agent_radio.cpp:927
static bool radioconnected
Definition: agent_radio.cpp:161
int32_t request_get_frequency(string &request, string &response, Agent *)
Definition: agent_radio.cpp:731
Radio Transceiver.
Definition: jsondef.h:512
Definition: jsondef.h:583
uint16_t txr_cnt
Definition: jsondef.h:3893
double freq
Input Frequency.
Definition: jsondef.h:2510
int32_t request_get_repeater_squelch(string &request, string &response, Agent *)
Definition: agent_radio.cpp:745
int32_t ic9100_get_bandpass(ic9100_handle &handle)
Definition: ic9100_lib.cpp:510
int32_t request_set_bandpass(string &request, string &response, Agent *)
Definition: agent_radio.cpp:765
static uint16_t radioaddr
Definition: agent_radio.cpp:160
vector< uint16_t > tcv
Definition: jsondef.h:3920
int32_t request_set_offset(string &request, string &response, Agent *)
Definition: agent_radio.cpp:791
static bool radioenabled
Definition: agent_radio.cpp:162
int32_t add_request(string token, external_request_function function, string synopsis="", string description="")
Add internal request to Agent request list with description and synopsis.
Definition: agentclass.cpp:312
int32_t request_set_opmode(string &request, string &response, Agent *)
Definition: agent_radio.cpp:809
float powerin
Definition: ic9100_lib.h:88
Definition: agentclass.h:139
static Agent * agent
Definition: agent_radio.cpp:154
int32_t request_set_modulation(string &request, string &response, Agent *)
Definition: agent_radio.cpp:911
float squelch_tone
repeater squelch tone frequency
Definition: jsondef.h:2524
int32_t request_get_powerin(string &request, string &response, Agent *)
Definition: agent_radio.cpp:773
int32_t usrp_get_frequency(usrp_handle &handle)
Definition: usrp_lib.cpp:148
Definition: jsondef.h:580
float band
Input Filter bandpass.
Definition: jsondef.h:2522
int32_t usrp_get_record(usrp_handle &handle)
Definition: usrp_lib.cpp:306
int32_t shutdown()
Shutdown agent gracefully.
Definition: agentclass.cpp:366
int32_t disconnect_radio()
Definition: agent_radio.cpp:1050
int32_t request_enable(string &request, string &response, Agent *)
Definition: agent_radio.cpp:702
static usrp_handle usrp
Definition: agent_radio.cpp:177
int32_t ic9100_set_mode(ic9100_handle &handle, uint8_t opmode)
Definition: ic9100_lib.cpp:974
double frequency
Definition: usrp_lib.h:93
int32_t ic9100_get_smeter(ic9100_handle &handle)
Definition: ic9100_lib.cpp:1202
static std::string radioname
Definition: agent_radio.cpp:156
int32_t ic9100_get_rfmeter(ic9100_handle &handle)
Definition: ic9100_lib.cpp:1243
int32_t request_disable(string &request, string &response, Agent *)
Definition: agent_radio.cpp:708
int32_t usrp_set_record(usrp_handle &handle, uint8_t record)
Definition: usrp_lib.cpp:322
int32_t request_set_frequency(string &request, string &response, Agent *)
Definition: agent_radio.cpp:737
int32_t ic9100_set_bandpass(ic9100_handle &handle, double bandpass)
Definition: ic9100_lib.cpp:362
static ic9100_handle ic9100
Definition: agent_radio.cpp:176
Definition: jsondef.h:582
int32_t request_get_opmode(string &request, string &response, Agent *)
Definition: agent_radio.cpp:803
int32_t request_set_maxpower(string &request, string &response, Agent *)
Definition: agent_radio.cpp:785
static uint16_t radiotype
Definition: agent_radio.cpp:169
static size_t deviceindex
Definition: agent_radio.cpp:157
static uint16_t model
Definition: agent_radio.cpp:168
Definition: jsondef.h:573
vector< agentstruc > agent
Single entry vector for agent information.
Definition: jsondef.h:4247
float bandpass
Definition: ic9100_lib.h:87
int32_t ic9100_get_rfpower(ic9100_handle &handle)
Definition: ic9100_lib.cpp:1162
int32_t ic9100_get_mode(ic9100_handle &handle)
Definition: ic9100_lib.cpp:810
int32_t request_get_modulation(string &request, string &response, Agent *)
Definition: agent_radio.cpp:905
vector< piecestruc > pieces
Vector of all pieces in node.
Definition: jsondef.h:4232
uint16_t rxr_cnt
Definition: jsondef.h:3881
Definition: jsondef.h:645
int32_t start_active_loop()
Definition: agentclass.cpp:347
int32_t json_createpiece(cosmosstruc *cinfo, string name, DeviceType ctype, double emi, double abs, double hcap, double hcon, double density)
Create new piece.
Definition: jsonlib.cpp:722
cosmosstruc * cinfo
Definition: agentclass.h:346
int32_t request_set_record(string &request, string &response, Agent *)
Definition: agent_radio.cpp:920
Definition: jsondef.h:568
#define AGENT_ERROR_JSON_CREATE
Definition: cosmos-errno.h:105
devspecstruc devspec
Structure for devices (components) special data in node, by type.
Definition: jsondef.h:4241
double frequency
Definition: ic9100_lib.h:92
int32_t request_get_bandpass(string &request, string &response, Agent *)
Definition: agent_radio.cpp:759
Definition: jsondef.h:560
float repeater_squelch
Definition: ic9100_lib.h:91
Radio Transmitter.
Definition: jsondef.h:510
Definition: jsondef.h:565
Definition: jsondef.h:578
static std::string radiodevice
Definition: agent_radio.cpp:159
Definition: jsondef.h:562
static float morefreqoffset
Definition: agent_radio.cpp:165
Definition: jsondef.h:577
int32_t json_createport(cosmosstruc *cinfo, string name, PORT_TYPE type)
Definition: jsonlib.cpp:1086

Variable Documentation

Agent* agent
static
std::string nodename =""
static
std::string radioname
static
size_t deviceindex
static
size_t radioindex = 9999
static
std::string radiodevice
static
uint16_t radioaddr
static
bool radioconnected = false
static
bool radioenabled = false
static
float freqoffset = 0.
static
float morefreqoffset = 0.
static
string port
static
uint16_t model
static
uint16_t radiotype = static_cast<uint16_t>(DeviceType::NONE)
static
float freq
static
float band
static
uint8_t opmode = static_cast<uint8_t>(DEVICE_RADIO_MODE_UNDEF)
static
ic9100_handle ic9100
static
usrp_handle usrp
static
uint8_t target_record
static
tcvstruc target
static
tcvstruc actual
static
tcvstruc initial
static
bool initialized = false
static
int32_t lasterrorcode
static
char lasterrormessage[300]
static