Add PPS support to SOCK driver
This commit is contained in:
parent
3bae6c3202
commit
6d242a33f5
2 changed files with 10 additions and 4 deletions
|
@ -2176,9 +2176,10 @@ Software that can be used as a source of timestamps includes
|
||||||
@item SOCK
|
@item SOCK
|
||||||
Unix domain socket driver. The parameter is a path to the socket
|
Unix domain socket driver. The parameter is a path to the socket
|
||||||
which is used as the source of timestamps. This is as a better
|
which is used as the source of timestamps. This is as a better
|
||||||
alternative to SHM, it does not require polling and the offset
|
alternative to SHM, it does not require polling, the offset
|
||||||
resolution is not limited to microsecond. The format for messages
|
resolution is not limited to microsecond and it supports PPS.
|
||||||
sent over the socket is declared in file @code{refclock_sock.c}.
|
The format for messages sent over the socket is declared in file
|
||||||
|
@code{refclock_sock.c}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
The @code{refclock} command also supports a number of subfields (which
|
The @code{refclock} command also supports a number of subfields (which
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
struct sock_sample {
|
struct sock_sample {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
double offset;
|
double offset;
|
||||||
|
int pulse;
|
||||||
int leap;
|
int leap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,7 +54,11 @@ static void read_sample(void *anything)
|
||||||
if (recv(sockfd, &sample, sizeof (sample), 0) != sizeof (sample))
|
if (recv(sockfd, &sample, sizeof (sample), 0) != sizeof (sample))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (sample.pulse) {
|
||||||
|
RCL_AddPulse(instance, &sample.tv, sample.offset);
|
||||||
|
} else {
|
||||||
RCL_AddSample(instance, &sample.tv, sample.offset, sample.leap);
|
RCL_AddSample(instance, &sample.tv, sample.offset, sample.leap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sock_initialise(RCL_Instance instance)
|
static int sock_initialise(RCL_Instance instance)
|
||||||
|
|
Loading…
Reference in a new issue