Skip to content

Commit

Permalink
CCB 2019-09-04: Merge #24 #4 #12 #6 #11 #5 #7 #14 #1
Browse files Browse the repository at this point in the history
Reviewed and approved at 2019-09-04 CCB
  • Loading branch information
skliper committed Sep 6, 2019
2 parents 0e85666 + f8c2fc7 commit ae911ab
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 737 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
cmdUtil
8 changes: 4 additions & 4 deletions Guide-GroundSystem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ The Ground System contains a main window that lets you launch the different util

Note: The Main Window needs to be opened at all times so that the telemetry messages can be forwarded to the Telemetry System.

The Ground System will automatically detect the spacecraft when it starts sending the telemetry, and it will be added to the ip addresses list. You can select the spacecraft from the list, and start Telemetry System to receive its data. If All spacecrafts are selected, you can start Telemetry System to display the packet count from multiple spacecrafts (if it detected more than one).
The Ground System will automatically detect the spacecraft when it starts sending the telemetry, and it will be added to the ip addresses list. You can select the spacecraft from the list, and start Telemetry System to receive its data. If 'All' spacecrafts are selected, you can start Telemetry System to display the packet count from multiple spacecrafts (if it detected more than one).

Future enhancements:
1. Detect different spacecrafts based on telemetry header(spacecraft id) data instead of using the spacecraft ip address.
2. Add instructions for Windows.


Before launching the Ground System make sure that:
> PyQt4 is installed.
> PyZMQ is installed.
> cmdUtil is compiled.
-> PyQt4 is installed.
-> PyZMQ is installed.
-> cmdUtil is compiled.


Installing and running cFS Ground System on Mac:
Expand Down
4 changes: 2 additions & 2 deletions Subsystems/Commands-Telemetry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Telemetry ( tlmGUI/ directory ):
UDP/IP packets. The "enable telemetry" command tells the TO_LAB application to start
sending packets to a UDP port on the "localhost" or a specified IP.

Start the telemetry system using the Ground Systems main window.
Start the telemetry system using the Ground System's main window.

Buttons are available for individual telemetry pages.
New pages can be added by adding to the "telemetry-pages.txt" text file.
Expand Down Expand Up @@ -63,7 +63,7 @@ Commands ( cmdGUI/ directory)
This is a simple Python / QT4 based Command GUI for the cmdUtil utility.
It provides a list of "command pages" with a list of commands to send to a subsystem.

Start the command system using the Ground Systems main window.
Start the command system using the Ground System's main window.

The program is written in Python 2.x with the PyQT4 GUI. The dialogs were created
in the QT4 designer program, and converted to python classes using the "pyuic4"
Expand Down
2 changes: 1 addition & 1 deletion Subsystems/cmdUtil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if (ENABLE_DATA_DICTIONARY)
include_directories(${msglib_MISSION_DIR}/inc)
endif()

add_executable(cmdUtil cmdUtil.c sendUdp.c)
add_executable(cmdUtil cmdUtil.c SendUdp.c)

if (ENABLE_DATA_DICTIONARY)
target_link_libraries(cmdUtil cfe_mission_dictionary msglib_full)
Expand Down
2 changes: 1 addition & 1 deletion Subsystems/cmdUtil/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
all::
gcc -o cmdUtil sendUdp.c cmdUtil.c
gcc -o cmdUtil SendUdp.c cmdUtil.c

57 changes: 31 additions & 26 deletions Subsystems/cmdUtil/sendUdp.c → Subsystems/cmdUtil/SendUdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
** Udp packet send routine
*/

#include "SendUdp.h"

#ifdef WIN32
#pragma warning (disable:4786)
#include <winsock2.h>
Expand All @@ -35,6 +37,7 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SOCKET int
#define closesocket(fd) close(fd)
#endif
Expand All @@ -45,11 +48,12 @@
int SendUdp(char *hostname, char *portNum, char *packetData, int packetSize) {
SOCKET sd;
int rc;
int port;
int errcode;
unsigned int i;
struct sockaddr_in cliAddr;
struct sockaddr_in remoteServAddr;
struct hostent *hostID;
int port;
struct addrinfo hints;
struct addrinfo *result;

#ifdef WIN32
WSADATA wsaData;
Expand All @@ -59,39 +63,38 @@ int SendUdp(char *hostname, char *portNum, char *packetData, int packetSize) {
if (hostname == NULL) {
return -1;
}

/*
** get server IP address (no check if input is IP address or DNS name
** Check port
*/
hostID = gethostbyname(hostname);
if (hostID == NULL) {
port = atoi(portNum);
if (port == -1) {
return -2;
}

/*
** Check port
**Criteria for selecting socket address
*/
port = atoi(portNum);
if (port == -1) {
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET; /*IPv4*/
hints.ai_socktype = SOCK_DGRAM; /*Datagram socket*/
hints.ai_flags = AI_CANONNAME;
hints.ai_protocol = 0; /*Any Protocol*/

errcode = getaddrinfo(hostname, portNum, &hints, &result);
if (errcode != 0) {
return -3;
}

printf("sending data to '%s' (IP : %s); port %d\n", hostID->h_name,
inet_ntoa(*(struct in_addr *)hostID->h_addr_list[0]), port);

/*
** Setup socket structures
*/
remoteServAddr.sin_family = hostID->h_addrtype;
memcpy((char *) &remoteServAddr.sin_addr.s_addr,
hostID->h_addr_list[0], hostID->h_length);
remoteServAddr.sin_port = htons(port);
printf("sending data to '%s' (IP : %s); port %d\n", result->ai_canonname,
inet_ntoa(((struct sockaddr_in*)result->ai_addr)->sin_addr), port);

/*
** Create Socket
*/
sd = socket(AF_INET,SOCK_DGRAM,0);
if (sd < 0) {
sd = socket(AF_INET, SOCK_DGRAM, 0);

if(sd < 0){
return -4;
}

Expand Down Expand Up @@ -121,15 +124,17 @@ int SendUdp(char *hostname, char *portNum, char *packetData, int packetSize) {
/*
** send the event
*/
rc = sendto(sd, (char*)packetData, packetSize, 0,
(struct sockaddr*)&remoteServAddr,
sizeof(remoteServAddr));
rc = sendto(sd, (char*)packetData, packetSize, 0,
result->ai_addr, result->ai_addrlen);


if (rc < 0) {
freeaddrinfo(result);
closesocket(sd);
return -6;
}

freeaddrinfo(result);
closesocket(sd);
return 0;
}
File renamed without changes.
9 changes: 2 additions & 7 deletions Subsystems/cmdUtil/cmdUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
#include "getopt.h"
#include <string.h>
#include <limits.h>

/*
** sendUdp prototype -- Used to send the completed command to a UDP network socket.
*/
int SendUdp(char *hostname, char *portNum, char *packetData, int packetSize);
#include "SendUdp.h"

/*
** Defines
Expand Down Expand Up @@ -236,7 +232,7 @@ void ProcessStringArgument(char *optarg, CommandData_t *CommandData) {
stringLenString[stringIndex] = '\0';
stringLength = strtol(stringLenString, NULL, 10);
if (CommandData->Verbose) {
printf("String Length is %d.\n", stringLength);
printf("String Length is %ld.\n", stringLength);
}

if (stringLength > 128) {
Expand Down Expand Up @@ -387,7 +383,6 @@ int main(int argc, char *argv[]) {
int opt = 0;
int longIndex = 0;
int retStat;
long tempLong;
short tempShort;

/*
Expand Down
148 changes: 0 additions & 148 deletions Subsystems/cmdUtil/cmdUtil.vcproj

This file was deleted.

Empty file modified Subsystems/cmdUtil/es-delete-app.sh
100644 → 100755
Empty file.
Loading

0 comments on commit ae911ab

Please sign in to comment.