Skip to content
Snippets Groups Projects
Commit 89cd1653 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fixed web service rpc parameters

parent 4eb022a0
No related branches found
No related tags found
No related merge requests found
Pipeline #14371 passed
......@@ -32,8 +32,8 @@ function RGBDClient(peer, N, rate, dest) {
/**
* Actually send a frame over network to the client.
*/
RGBDClient.prototype.push = function(uri, frame, ttime, chunk, rgb, depth) {
this.peer.send(uri, frame, ttime, chunk, rgb, depth);
RGBDClient.prototype.push = function(uri, latency, spacket, packet) {
this.peer.send(uri, latency, spacket, packet);
this.txcount++;
}
......@@ -58,14 +58,23 @@ function RGBDStream(uri, peer) {
this.rxmax = 10;
// Add RPC handler to receive frames from the source
peer.bind(uri, (frame, ttime, chunk, rgb, depth) => {
peer.bind(uri, (latency, spacket, packet) => {
// Forward frames to all clients
this.pushFrames(frame, ttime, chunk, rgb, depth);
this.pushFrames(latency, spacket, packet);
this.rxcount++;
if (this.rxcount >= this.rxmax && this.clients.length > 0) {
this.subscribe();
}
});
/*peer.bind(uri, (frame, ttime, chunk, rgb, depth) => {
// Forward frames to all clients
this.pushFrames(frame, ttime, chunk, rgb, depth);
this.rxcount++;
if (this.rxcount >= this.rxmax && this.clients.length > 0) {
this.subscribe();
}
});*/
}
RGBDStream.prototype.addClient = function(peer, N, rate, dest) {
......@@ -88,12 +97,12 @@ RGBDStream.prototype.subscribe = function() {
this.peer.send("get_stream", this.uri, 10, 0, [Peer.uuid], this.uri);
}
RGBDStream.prototype.pushFrames = function(frame, ttime, chunk, rgb, depth) {
this.rgb = rgb;
this.depth = depth;
RGBDStream.prototype.pushFrames = function(latency, spacket, packet) {
if (spacket[1] & 0x1) this.depth = packet[4];
else this.rgb = packet[4];
for (let i=0; i < this.clients.length; i++) {
this.clients[i].push(this.uri, frame, ttime, chunk, rgb, depth);
this.clients[i].push(this.uri, latency, spacket, packet);
}
let i=0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment