WPILibC++  2018.4.1-20180926031727-1206-g8b1274d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ntcore_test.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2016-2018 FIRST. 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_NTCORE_TEST_H_
9 #define NTCORE_NTCORE_TEST_H_
10 
11 #include <stdint.h>
12 
13 #include <string>
14 
15 #include "ntcore.h"
16 
17 // Functions in this header are to be used only for testing
18 
19 extern "C" {
20 struct NT_String* NT_GetStringForTesting(const char* string, int* struct_size);
21 // No need for free as one already exists in main library
22 
23 struct NT_EntryInfo* NT_GetEntryInfoForTesting(const char* name,
24  enum NT_Type type,
25  unsigned int flags,
26  uint64_t last_change,
27  int* struct_size);
28 
29 void NT_FreeEntryInfoForTesting(struct NT_EntryInfo* info);
30 
31 struct NT_ConnectionInfo* NT_GetConnectionInfoForTesting(
32  const char* remote_id, const char* remote_ip, unsigned int remote_port,
33  uint64_t last_update, unsigned int protocol_version, int* struct_size);
34 
35 void NT_FreeConnectionInfoForTesting(struct NT_ConnectionInfo* info);
36 
37 struct NT_Value* NT_GetValueBooleanForTesting(uint64_t last_change, int val,
38  int* struct_size);
39 
40 struct NT_Value* NT_GetValueDoubleForTesting(uint64_t last_change, double val,
41  int* struct_size);
42 
43 struct NT_Value* NT_GetValueStringForTesting(uint64_t last_change,
44  const char* str, int* struct_size);
45 
46 struct NT_Value* NT_GetValueRawForTesting(uint64_t last_change, const char* raw,
47  int raw_len, int* struct_size);
48 
49 struct NT_Value* NT_GetValueBooleanArrayForTesting(uint64_t last_change,
50  const int* arr,
51  size_t array_len,
52  int* struct_size);
53 
54 struct NT_Value* NT_GetValueDoubleArrayForTesting(uint64_t last_change,
55  const double* arr,
56  size_t array_len,
57  int* struct_size);
58 
59 struct NT_Value* NT_GetValueStringArrayForTesting(uint64_t last_change,
60  const struct NT_String* arr,
61  size_t array_len,
62  int* struct_size);
63 // No need for free as one already exists in the main library
64 
65 struct NT_RpcParamDef* NT_GetRpcParamDefForTesting(const char* name,
66  const struct NT_Value* val,
67  int* struct_size);
68 
69 void NT_FreeRpcParamDefForTesting(struct NT_RpcParamDef* def);
70 
71 struct NT_RpcResultDef* NT_GetRpcResultsDefForTesting(const char* name,
72  enum NT_Type type,
73  int* struct_size);
74 
75 void NT_FreeRpcResultsDefForTesting(struct NT_RpcResultDef* def);
76 
77 struct NT_RpcDefinition* NT_GetRpcDefinitionForTesting(
78  unsigned int version, const char* name, size_t num_params,
79  const struct NT_RpcParamDef* params, size_t num_results,
80  const struct NT_RpcResultDef* results, int* struct_size);
81 // No need for free as one already exists in the main library
82 
83 struct NT_RpcCallInfo* NT_GetRpcCallInfoForTesting(
84  unsigned int rpc_id, unsigned int call_uid, const char* name,
85  const char* params, size_t params_len, int* struct_size);
86 // No need for free as one already exists in the main library
87 } // extern "C"
88 
89 #endif // NTCORE_NTCORE_TEST_H_
unsigned int protocol_version
The protocol version being used for this connection.
Definition: ntcore_c.h:187
uint64_t last_change
Timestamp of last change to entry (type or value).
Definition: ntcore_c.h:160
uint64_t last_update
The last time any update was received from the remote node (same scale as returned by nt::Now())...
Definition: ntcore_c.h:181
unsigned int remote_port
The port number of the remote node.
Definition: ntcore_c.h:175
NetworkTables RPC Version 1 Definition Result.
Definition: ntcore_c.h:197
NetworkTables Connection Information.
Definition: ntcore_c.h:164
NetworkTables Entry Value.
Definition: ntcore_c.h:122
NetworkTables Entry Information.
Definition: ntcore_c.h:146
NT_Type
NetworkTables data types.
Definition: ntcore_c.h:52
A NetworkTables string.
Definition: ntcore_c.h:105
NetworkTables RPC Version 1 Definition.
Definition: ntcore_c.h:203
NetworkTables RPC Version 1 Definition Parameter.
Definition: ntcore_c.h:191
enum NT_Type type
Entry type.
Definition: ntcore_c.h:154
struct NT_String remote_ip
The IP address of the remote node.
Definition: ntcore_c.h:172
struct NT_String remote_id
The remote identifier (as set on the remote node by NetworkTableInstance::SetNetworkIdentity() or nt:...
Definition: ntcore_c.h:169