GenericPublisher

class ntcore.GenericPublisher

Bases: Publisher

NetworkTables generic publisher.

getTopic() ntcore._ntcore.Topic

Get the corresponding topic.

Returns:

Topic

set(value: ntcore._ntcore.Value) None

Publish a new value.

Parameters:

value – value to publish

setBoolean(value: bool, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setBooleanArray(*args, **kwargs)

Overloaded function.

  1. setBooleanArray(self: ntcore._ntcore.GenericPublisher, value: List[bool], time: typing.SupportsInt | typing.SupportsIndex = 0) -> bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

  1. setBooleanArray(self: ntcore._ntcore.GenericPublisher, value: List[typing.SupportsInt | typing.SupportsIndex], time: typing.SupportsInt | typing.SupportsIndex = 0) -> bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setDefault(value: ntcore._ntcore.Value) None

Publish a default value. On reconnect, a default value will never be used in preference to a published value.

Parameters:

value – value

setDefaultBoolean(defaultValue: bool) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultBooleanArray(defaultValue: List[SupportsInt | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultDouble(defaultValue: SupportsFloat | SupportsIndex) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultDoubleArray(defaultValue: List[SupportsFloat | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultFloat(defaultValue: SupportsFloat | SupportsIndex) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultFloatArray(defaultValue: List[SupportsFloat | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultInteger(defaultValue: SupportsInt | SupportsIndex) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultIntegerArray(defaultValue: List[SupportsInt | SupportsIndex]) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultRaw(defaultValue: Buffer) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultString(defaultValue: str) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDefaultStringArray(defaultValue: List[str]) bool

Sets the entry’s value if it does not exist.

Parameters:

defaultValue – the default value to set

Returns:

True if the entry did not already have a value, otherwise False

setDouble(value: SupportsFloat | SupportsIndex, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setDoubleArray(value: List[SupportsFloat | SupportsIndex], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setFloat(value: SupportsFloat | SupportsIndex, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setFloatArray(value: List[SupportsFloat | SupportsIndex], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setInteger(value: SupportsInt | SupportsIndex, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setIntegerArray(value: List[SupportsInt | SupportsIndex], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setRaw(value: Buffer, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setString(value: str, time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type

setStringArray(value: List[str], time: SupportsInt | SupportsIndex = 0) bool

Sets the entry’s value.

Parameters:
  • value – the value to set

  • time – the timestamp to set (0 = wpi::nt::Now())

Returns:

False if the entry exists with a different type