WPILibC++  unspecified
ntcore_test.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2016. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef NTCORE_TEST_H_
9 #define NTCORE_TEST_H_
10 
11 #include "ntcore.h"
12 
13 // Functions in this header are to be used only for testing
14 
15 extern "C" {
16 struct NT_String* NT_GetStringForTesting(const char* string, int* struct_size);
17 // No need for free as one already exists in main library
18 
19 struct NT_EntryInfo* NT_GetEntryInfoForTesting(const char* name,
20  enum NT_Type type,
21  unsigned int flags,
22  unsigned long long last_change,
23  int* struct_size);
24 
25 void NT_FreeEntryInfoForTesting(struct NT_EntryInfo* info);
26 
27 struct NT_ConnectionInfo* NT_GetConnectionInfoForTesting(
28  const char* remote_id, const char* remote_ip, unsigned int remote_port,
29  unsigned long long last_update, unsigned int protocol_version,
30  int* struct_size);
31 
32 void NT_FreeConnectionInfoForTesting(struct NT_ConnectionInfo* info);
33 
34 struct NT_Value* NT_GetValueBooleanForTesting(unsigned long long last_change,
35  int val, int* struct_size);
36 
37 struct NT_Value* NT_GetValueDoubleForTesting(unsigned long long last_change,
38  double val, int* struct_size);
39 
40 struct NT_Value* NT_GetValueStringForTesting(unsigned long long last_change,
41  const char* str, int* struct_size);
42 
43 struct NT_Value* NT_GetValueRawForTesting(unsigned long long last_change,
44  const char* raw, int raw_len,
45  int* struct_size);
46 
47 struct NT_Value* NT_GetValueBooleanArrayForTesting(
48  unsigned long long last_change, const int* arr, size_t array_len,
49  int* struct_size);
50 
51 struct NT_Value* NT_GetValueDoubleArrayForTesting(
52  unsigned long long last_change, const double* arr, size_t array_len,
53  int* struct_size);
54 
55 struct NT_Value* NT_GetValueStringArrayForTesting(
56  unsigned long long last_change, const struct NT_String* arr,
57  size_t array_len, int* struct_size);
58 // No need for free as one already exists in the main library
59 
60 struct NT_RpcParamDef* NT_GetRpcParamDefForTesting(const char* name,
61  const struct NT_Value* val,
62  int* struct_size);
63 
64 void NT_FreeRpcParamDefForTesting(struct NT_RpcParamDef* def);
65 
66 struct NT_RpcResultDef* NT_GetRpcResultsDefForTesting(const char* name,
67  enum NT_Type type,
68  int* struct_size);
69 
70 void NT_FreeRpcResultsDefForTesting(struct NT_RpcResultDef* def);
71 
72 struct NT_RpcDefinition* NT_GetRpcDefinitionForTesting(
73  unsigned int version, const char* name, size_t num_params,
74  const struct NT_RpcParamDef* params, size_t num_results,
75  const struct NT_RpcResultDef* results, int* struct_size);
76 // No need for free as one already exists in the main library
77 
78 struct NT_RpcCallInfo* NT_GetRpcCallInfoForTesting(
79  unsigned int rpc_id, unsigned int call_uid, const char* name,
80  const char* params, size_t params_len, int* struct_size);
81 // No need for free as one already exists in the main library
82 }
83 
84 #endif /* NTCORE_TEST_H_ */
unsigned int protocol_version
The protocol version being used for this connection.
Definition: ntcore_c.h:173
unsigned int remote_port
The port number of the remote node.
Definition: ntcore_c.h:161
NetworkTables RPC Version 1 Definition Result.
Definition: ntcore_c.h:183
NetworkTables Connection Information.
Definition: ntcore_c.h:150
NetworkTables Entry Value.
Definition: ntcore_c.h:108
NetworkTables Entry Information.
Definition: ntcore_c.h:132
unsigned int flags
Entry flags.
Definition: ntcore_c.h:143
unsigned long long last_change
Timestamp of last change to entry (type or value).
Definition: ntcore_c.h:146
unsigned long long last_update
The last time any update was received from the remote node (same scale as returned by nt::Now())...
Definition: ntcore_c.h:167
struct NT_String name
Entry name.
Definition: ntcore_c.h:137
A NetworkTables string.
Definition: ntcore_c.h:91
NetworkTables RPC Version 1 Definition.
Definition: ntcore_c.h:189
NetworkTables RPC Version 1 Definition Parameter.
Definition: ntcore_c.h:177
enum NT_Type type
Entry type.
Definition: ntcore_c.h:140
struct NT_String remote_ip
The IP address of the remote node.
Definition: ntcore_c.h:158
struct NT_String remote_id
The remote identifier (as set on the remote node by NetworkTableInstance::SetNetworkIdentity() or nt:...
Definition: ntcore_c.h:155