Add TCP address:port to displayed parameters for use in simulation
r3655 | dcl | 2012-07-19 14:57:03 +1000 (Thu, 19 Jul 2012) | 1 line
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
#include <motor.h>
|
#include <motor.h>
|
||||||
#include <dynstring.h>
|
#include <dynstring.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include "anstoutil.h"
|
#include "anstoutil.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
@@ -3571,6 +3572,17 @@ static void DMC2280StrList(pDMC2280Driv self, char *name, SConnection *pCon){
|
|||||||
}
|
}
|
||||||
snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, self->units);
|
snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, self->units);
|
||||||
SCWrite(pCon, buffer, eStatus);
|
SCWrite(pCon, buffer, eStatus);
|
||||||
|
if (self->asyncUnit) {
|
||||||
|
mkChannel* sock = AsyncUnitGetSocket(self->asyncUnit);
|
||||||
|
if (sock) {
|
||||||
|
char addr[80];
|
||||||
|
int port = ntohs(sock->adresse.sin_port);
|
||||||
|
strncpy(addr, inet_ntoa(sock->adresse.sin_addr), 80);
|
||||||
|
addr[79] = '\0';
|
||||||
|
snprintf(buffer, BUFFLEN, "%s.address = %s:%d\n", self->name, addr, port);
|
||||||
|
SCWrite(pCon, buffer, eStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/** \brief List the motor parameters to the client.
|
/** \brief List the motor parameters to the client.
|
||||||
@@ -4074,6 +4086,21 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (strcasecmp("address", argv[1]) == 0) {
|
||||||
|
if (self->asyncUnit) {
|
||||||
|
mkChannel* sock = AsyncUnitGetSocket(self->asyncUnit);
|
||||||
|
if (sock) {
|
||||||
|
char line[132];
|
||||||
|
char addr[80];
|
||||||
|
int port = ntohs(sock->adresse.sin_port);
|
||||||
|
strncpy(addr, inet_ntoa(sock->adresse.sin_addr), 80);
|
||||||
|
addr[79] = '\0';
|
||||||
|
snprintf(line, 132, "%s.address = %s:%d\n", self->name, addr, port);
|
||||||
|
SCWrite(pCon, line, eStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
else if (strcasecmp("axis", argv[1]) == 0) {
|
else if (strcasecmp("axis", argv[1]) == 0) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
if (islower(argv[2][0]))
|
if (islower(argv[2][0]))
|
||||||
|
|||||||
Reference in New Issue
Block a user