#include "NeovisionII/nv2_label_server.h"
#include "NeovisionII/nv2_common.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Go to the source code of this file.
Classes | |
struct | nv2_label_server |
Functions | |
static void * | run_patch_reader (void *vq) |
struct nv2_label_server * | nv2_label_server_create (const int patch_reader_port, const char *remote_label_reader_addr, const int remote_label_reader_port) |
Create a label server (which will also be a patch reader). | |
void | nv2_label_server_destroy (struct nv2_label_server *p) |
Destroy a label server and release all resources associated with it. | |
enum nv2_image_patch_result | nv2_label_server_get_current_patch (struct nv2_label_server *p, struct nv2_image_patch *ret) |
Get the most recently received patch. | |
enum nv2_label_send_result | nv2_label_server_send_label (struct nv2_label_server *p, const struct nv2_patch_label *l) |
Send a patch label. | |
void | nv2_label_server_set_verbosity (struct nv2_label_server *p, const int verbosity) |
Set the verbosity level for the label server. |
Definition in file nv2_label_server.c.
struct nv2_label_server* nv2_label_server_create | ( | const int | patch_reader_port, | |
const char * | remote_label_reader_addr, | |||
const int | remote_label_reader_port | |||
) | [read] |
Create a label server (which will also be a patch reader).
patch_reader_port | tcp port on which the patch reader should run on this host machine (by default you should use NV2_PATCH_READER_PORT) | |
remote_label_reader_addr | ip address to which we should connect to find the label reader | |
remote_label_reader_port | tcp port on which the label reader is running on remote_label_reader_addr |
Definition at line 252 of file nv2_label_server.c.
References nv2_fatal, and nv2_image_patch_init_empty().
void nv2_label_server_destroy | ( | struct nv2_label_server * | p | ) |
Destroy a label server and release all resources associated with it.
Definition at line 289 of file nv2_label_server.c.
References nv2_fatal, and nv2_image_patch_destroy().
enum nv2_image_patch_result nv2_label_server_get_current_patch | ( | struct nv2_label_server * | p, | |
struct nv2_image_patch * | ret | |||
) |
Get the most recently received patch.
p | handle to the label server from which to retrieve the patch | |
ret | the returned image patch; NOTE that ownership of the nv2_image_patch object is transferred to the caller here, so that the caller is responsible for freeing resources associated with this image patch by calling nv2_image_patch_destroy() after use |
Definition at line 305 of file nv2_label_server.c.
References NV2_IMAGE_PATCH_END, nv2_image_patch_init_empty(), NV2_IMAGE_PATCH_NONE, and NV2_IMAGE_PATCH_VALID.
enum nv2_label_send_result nv2_label_server_send_label | ( | struct nv2_label_server * | p, | |
const struct nv2_patch_label * | l | |||
) |
Send a patch label.
p | handle to the label server from which to send the patch label | |
l | patch label to be sent |
Definition at line 320 of file nv2_label_server.c.
References nv2_patch_label::confidence, nv2_fatal, NV2_LABEL_SEND_FAIL, NV2_LABEL_SEND_OK, nv2_robust_write(), and nv2_warn.
void nv2_label_server_set_verbosity | ( | struct nv2_label_server * | p, | |
const int | verbosity | |||
) |
Set the verbosity level for the label server.
verbosity | if 0, then don't print anything except fatal error messages; if 1, then also print warnings (but not informational messages) |
Definition at line 362 of file nv2_label_server.c.