or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

entry-interface.mdindex.mdinstance-management.mdintegration-utilities.mdlisteners-events.mdpersistence-data.mdtable-operations.md

entry-interface.mddocs/

0

# Entry Interface

1

2

Type-safe interface to individual NetworkTables entries with efficient access patterns. Provides the most performant way to read and write NetworkTable values by avoiding repeated key lookups and table navigation.

3

4

## Capabilities

5

6

### Entry Information

7

8

Get metadata and status information about entries.

9

10

```python { .api }

11

class NetworkTableEntry:

12

def exists() -> bool:

13

"""

14

Check if the entry currently exists in NetworkTables.

15

16

Returns:

17

bool: True if entry exists, False otherwise

18

"""

19

20

def getName() -> str:

21

"""

22

Get the full name/path of the entry.

23

24

Returns:

25

str: Full entry path (e.g., "/SmartDashboard/speed")

26

"""

27

28

def getType() -> int:

29

"""

30

Get the type of the entry.

31

32

Returns:

33

int: Entry type constant (NT_BOOLEAN, NT_DOUBLE, NT_STRING, etc.)

34

"""

35

36

def getFlags() -> int:

37

"""

38

Get the flags bitmask for the entry.

39

40

Returns:

41

int: Bitmask of entry flags (e.g., NT_PERSISTENT)

42

"""

43

44

def getInfo() -> tuple:

45

"""

46

Get combined information about the entry.

47

48

Returns:

49

tuple: (name, type, flags) tuple with entry metadata

50

"""

51

52

def getHandle() -> int:

53

"""

54

Get the internal handle for this entry.

55

56

Returns:

57

int: Internal entry handle for advanced use

58

"""

59

```

60

61

### Current Value Access

62

63

Access the current value of an entry with type safety.

64

65

```python { .api }

66

@property

67

def value:

68

"""

69

Property to access the current value of this entry, or None if uninitialized.

70

71

Returns:

72

Any: Current entry value or None

73

"""

74

75

def getBoolean(defaultValue) -> bool:

76

"""

77

Get the entry's value as a boolean.

78

79

Parameters:

80

- defaultValue: bool. Value to return if entry doesn't exist or is wrong type

81

82

Returns:

83

bool: Entry value or default value

84

"""

85

86

def getDouble(defaultValue) -> float:

87

"""

88

Get the entry's value as a double/float.

89

90

Parameters:

91

- defaultValue: float. Value to return if entry doesn't exist or is wrong type

92

93

Returns:

94

float: Entry value or default value

95

"""

96

97

def getString(defaultValue) -> str:

98

"""

99

Get the entry's value as a string.

100

101

Parameters:

102

- defaultValue: str. Value to return if entry doesn't exist or is wrong type

103

104

Returns:

105

str: Entry value or default value

106

"""

107

108

def getRaw(defaultValue) -> bytes:

109

"""

110

Get the entry's value as raw bytes.

111

112

Parameters:

113

- defaultValue: bytes. Value to return if entry doesn't exist or is wrong type

114

115

Returns:

116

bytes: Entry value or default value

117

"""

118

119

def getBooleanArray(defaultValue) -> List[bool]:

120

"""

121

Get the entry's value as a boolean array.

122

123

Parameters:

124

- defaultValue: List[bool]. Value to return if entry doesn't exist or is wrong type

125

126

Returns:

127

List[bool]: Entry value or default value

128

"""

129

130

def getDoubleArray(defaultValue) -> List[float]:

131

"""

132

Get the entry's value as a double array.

133

134

Parameters:

135

- defaultValue: List[float]. Value to return if entry doesn't exist or is wrong type

136

137

Returns:

138

List[float]: Entry value or default value

139

"""

140

141

def getStringArray(defaultValue) -> List[str]:

142

"""

143

Get the entry's value as a string array.

144

145

Parameters:

146

- defaultValue: List[str]. Value to return if entry doesn't exist or is wrong type

147

148

Returns:

149

List[str]: Entry value or default value

150

"""

151

```

152

153

### Value Setting

154

155

Set entry values with type safety and validation.

156

157

```python { .api }

158

def setValue(value):

159

"""

160

Set the entry's value with automatic type detection.

161

162

Parameters:

163

- value: Any. Value to set (bool, float, str, bytes, or arrays thereof)

164

"""

165

166

def setBoolean(value: bool):

167

"""

168

Set the entry's value as a boolean.

169

170

Parameters:

171

- value: bool. Boolean value to set

172

"""

173

174

def setDouble(value: float):

175

"""

176

Set the entry's value as a double/float.

177

178

Parameters:

179

- value: float. Numeric value to set

180

"""

181

182

def setString(value: str):

183

"""

184

Set the entry's value as a string.

185

186

Parameters:

187

- value: str. String value to set

188

"""

189

190

def setRaw(value: bytes):

191

"""

192

Set the entry's value as raw bytes.

193

194

Parameters:

195

- value: bytes. Raw data to set

196

"""

197

198

def setBooleanArray(value: List[bool]):

199

"""

200

Set the entry's value as a boolean array.

201

202

Parameters:

203

- value: List[bool]. Boolean array to set

204

"""

205

206

def setDoubleArray(value: List[float]):

207

"""

208

Set the entry's value as a double array.

209

210

Parameters:

211

- value: List[float]. Numeric array to set

212

"""

213

214

def setStringArray(value: List[str]):

215

"""

216

Set the entry's value as a string array.

217

218

Parameters:

219

- value: List[str]. String array to set

220

"""

221

```

222

223

### Forced Value Setting

224

225

Force value setting with type conversion when needed.

226

227

```python { .api }

228

def forceSetValue(value):

229

"""

230

Force set the entry's value, allowing type changes.

231

232

Parameters:

233

- value: Any. Value to set, changing type if necessary

234

"""

235

236

def forceSetBoolean(value: bool):

237

"""

238

Force set the entry's value as a boolean, changing type if necessary.

239

240

Parameters:

241

- value: bool. Boolean value to set

242

"""

243

244

def forceSetDouble(value: float):

245

"""

246

Force set the entry's value as a double, changing type if necessary.

247

248

Parameters:

249

- value: float. Numeric value to set

250

"""

251

252

def forceSetString(value: str):

253

"""

254

Force set the entry's value as a string, changing type if necessary.

255

256

Parameters:

257

- value: str. String value to set

258

"""

259

260

def forceSetRaw(value: bytes):

261

"""

262

Force set the entry's value as raw bytes, changing type if necessary.

263

264

Parameters:

265

- value: bytes. Raw data to set

266

"""

267

268

def forceSetBooleanArray(value: List[bool]):

269

"""

270

Force set the entry's value as a boolean array, changing type if necessary.

271

272

Parameters:

273

- value: List[bool]. Boolean array to set

274

"""

275

276

def forceSetDoubleArray(value: List[float]):

277

"""

278

Force set the entry's value as a double array, changing type if necessary.

279

280

Parameters:

281

- value: List[float]. Numeric array to set

282

"""

283

284

def forceSetStringArray(value: List[str]):

285

"""

286

Force set the entry's value as a string array, changing type if necessary.

287

288

Parameters:

289

- value: List[str]. String array to set

290

"""

291

```

292

293

### Default Values

294

295

Set default values without overwriting existing data.

296

297

```python { .api }

298

def setDefaultValue(defaultValue):

299

"""

300

Set default value for the entry without overwriting existing values.

301

302

Parameters:

303

- defaultValue: Any. Default value to set if entry doesn't exist

304

"""

305

306

def setDefaultBoolean(defaultValue: bool):

307

"""

308

Set default boolean value for the entry.

309

310

Parameters:

311

- defaultValue: bool. Default boolean value

312

"""

313

314

def setDefaultDouble(defaultValue: float):

315

"""

316

Set default numeric value for the entry.

317

318

Parameters:

319

- defaultValue: float. Default numeric value

320

"""

321

322

def setDefaultString(defaultValue: str):

323

"""

324

Set default string value for the entry.

325

326

Parameters:

327

- defaultValue: str. Default string value

328

"""

329

330

def setDefaultRaw(defaultValue: bytes):

331

"""

332

Set default raw bytes value for the entry.

333

334

Parameters:

335

- defaultValue: bytes. Default raw data

336

"""

337

338

def setDefaultBooleanArray(defaultValue: List[bool]):

339

"""

340

Set default boolean array value for the entry.

341

342

Parameters:

343

- defaultValue: List[bool]. Default boolean array

344

"""

345

346

def setDefaultDoubleArray(defaultValue: List[float]):

347

"""

348

Set default numeric array value for the entry.

349

350

Parameters:

351

- defaultValue: List[float]. Default numeric array

352

"""

353

354

def setDefaultStringArray(defaultValue: List[str]):

355

"""

356

Set default string array value for the entry.

357

358

Parameters:

359

- defaultValue: List[str]. Default string array

360

"""

361

```

362

363

### Persistence and Flags

364

365

Control entry persistence and flags.

366

367

```python { .api }

368

def setPersistent():

369

"""Make the entry persistent across NetworkTables restarts."""

370

371

def clearPersistent():

372

"""Remove persistence from the entry."""

373

374

def isPersistent() -> bool:

375

"""

376

Check if the entry is persistent.

377

378

Returns:

379

bool: True if entry is persistent, False otherwise

380

"""

381

382

def setFlags(flags: int):

383

"""

384

Set flags for the entry.

385

386

Parameters:

387

- flags: int. Bitmask of flags to set

388

"""

389

390

def clearFlags(flags: int):

391

"""

392

Clear flags for the entry.

393

394

Parameters:

395

- flags: int. Bitmask of flags to clear

396

"""

397

```

398

399

### Entry Management

400

401

Delete entries and manage their lifecycle.

402

403

```python { .api }

404

def delete() -> bool:

405

"""

406

Delete the entry from NetworkTables.

407

408

Returns:

409

bool: True if entry was deleted, False if it didn't exist

410

"""

411

```

412

413

### Listener Management

414

415

Add and remove listeners for this specific entry.

416

417

```python { .api }

418

def addListener(listener: Callable, flags: int, paramIsNew: bool = True) -> int:

419

"""

420

Add a listener for changes to this entry.

421

422

Parameters:

423

- listener: Callable. Function called when entry changes

424

- flags: int. Bitmask of notification flags (NT_NOTIFY_NEW, NT_NOTIFY_UPDATE, etc.)

425

- paramIsNew: bool. Whether to pass isNew parameter to listener

426

427

Returns:

428

int: Listener ID for removal

429

"""

430

431

def removeListener(listener_id: int):

432

"""

433

Remove a listener by ID.

434

435

Parameters:

436

- listener_id: int. ID returned from addListener

437

"""

438

```

439

440

### Static Utilities

441

442

Static methods for type validation.

443

444

```python { .api }

445

@staticmethod

446

def isValidDataType(data) -> bool:

447

"""

448

Check if data is a valid NetworkTables type.

449

450

Parameters:

451

- data: Any. Data to validate

452

453

Returns:

454

bool: True if data type is supported by NetworkTables

455

"""

456

```

457

458

## Usage Examples

459

460

### Efficient Value Access

461

462

```python

463

from networktables import NetworkTables

464

465

# Get entry once and reuse for efficiency

466

speed_entry = NetworkTables.getEntry('/SmartDashboard/speed')

467

heading_entry = NetworkTables.getEntry('/SmartDashboard/heading')

468

469

# Read values efficiently (no key lookup each time)

470

current_speed = speed_entry.getDouble(0.0)

471

current_heading = heading_entry.getDouble(0.0)

472

473

# Write values efficiently

474

speed_entry.setDouble(42.5)

475

heading_entry.setDouble(180.0)

476

```

477

478

### Type Safety and Default Values

479

480

```python

481

from networktables import NetworkTables

482

483

# Create entry with default value

484

enabled_entry = NetworkTables.getEntry('/robot/enabled')

485

enabled_entry.setDefaultBoolean(False)

486

487

# Type-safe access with fallback

488

is_enabled = enabled_entry.getBoolean(False)

489

490

# Check entry status

491

if enabled_entry.exists():

492

print(f"Entry type: {enabled_entry.getType()}")

493

print(f"Entry name: {enabled_entry.getName()}")

494

```

495

496

### Persistence Management

497

498

```python

499

from networktables import NetworkTables

500

501

# Make configuration persistent

502

config_entry = NetworkTables.getEntry('/config/maxSpeed')

503

config_entry.setDefaultDouble(1.0)

504

config_entry.setPersistent()

505

506

# Check persistence status

507

if config_entry.isPersistent():

508

print("Configuration will survive restart")

509

```

510

511

### Array Operations

512

513

```python

514

from networktables import NetworkTables

515

516

# Work with arrays efficiently

517

pose_entry = NetworkTables.getEntry('/robot/pose')

518

target_entry = NetworkTables.getEntry('/vision/targets')

519

520

# Set array values

521

pose_entry.setDoubleArray([1.2, 3.4, 0.785])

522

target_entry.setStringArray(['target1', 'target2', 'target3'])

523

524

# Get array values with defaults

525

current_pose = pose_entry.getDoubleArray([0.0, 0.0, 0.0])

526

visible_targets = target_entry.getStringArray([])

527

```

528

529

### Entry Listeners

530

531

```python

532

from networktables import NetworkTables

533

534

def on_speed_change(entry, value, isNew):

535

print(f"Speed changed to: {value}")

536

537

# Add listener to specific entry

538

speed_entry = NetworkTables.getEntry('/SmartDashboard/speed')

539

listener_id = speed_entry.addListener(

540

on_speed_change,

541

NetworkTables.NotifyFlags.UPDATE | NetworkTables.NotifyFlags.NEW

542

)

543

544

# Remove listener later

545

speed_entry.removeListener(listener_id)

546

```

547

548

## Entry Type Constants

549

550

```python { .api }

551

# Entry type constants for getType() results

552

NT_BOOLEAN = 0x01

553

NT_DOUBLE = 0x02

554

NT_STRING = 0x04

555

NT_RAW = 0x08

556

NT_BOOLEAN_ARRAY = 0x10

557

NT_DOUBLE_ARRAY = 0x20

558

NT_STRING_ARRAY = 0x40

559

```