RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
MultiSubscriber.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5package org.wpilib.networktables;
6
11public final class MultiSubscriber implements AutoCloseable {
19 public MultiSubscriber(NetworkTableInstance inst, String[] prefixes, PubSubOption... options) {
20 m_inst = inst;
21 m_handle = NetworkTablesJNI.subscribeMultiple(inst.getHandle(), prefixes, options);
22 }
23
24 @Override
25 public synchronized void close() {
26 if (m_handle != 0) {
27 NetworkTablesJNI.unsubscribeMultiple(m_handle);
28 m_handle = 0;
29 }
30 }
31
38 return m_inst;
39 }
40
46 public boolean isValid() {
47 return m_handle != 0;
48 }
49
55 public int getHandle() {
56 return m_handle;
57 }
58
59 private final NetworkTableInstance m_inst;
60 private int m_handle;
61}
MultiSubscriber(NetworkTableInstance inst, String[] prefixes, PubSubOption... options)