-
public final class NIMMSTAManagerHolds the connected devices of the NIMMSTA App and some settings. Now uses dependency injection instead of singleton pattern.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classNIMMSTAManager.Companion
-
Field Summary
Fields Modifier and Type Field Description private final List<NIMMSTADevice>devicesprivate final List<NIMMSTADevice>connectedDevicesprivate ManagerSettingssettingsprivate BooleanallowMultiDeviceprivate BooleaninterpretButtonAsMotionTriggerprivate final BooleanisActive
-
Constructor Summary
Constructors Constructor Description NIMMSTAManager()
-
Method Summary
Modifier and Type Method Description final List<NIMMSTADevice>getDevices()final List<NIMMSTADevice>getConnectedDevices()final ManagerSettingsgetSettings()Stores and manages the current settings of the NIMMSTAManager. final UnitsetSettings(ManagerSettings settings)final BooleangetAllowMultiDevice()final UnitsetAllowMultiDevice(Boolean allowMultiDevice)final BooleangetInterpretButtonAsMotionTrigger()final UnitsetInterpretButtonAsMotionTrigger(Boolean interpretButtonAsMotionTrigger)final BooleangetIsActive()final Task<Unit>getInitialManagerInfos()Initial request after creation to get devices and settings final NIMMSTADevicegetDeviceWithAddress(String address)Tries to return the device with the given address null if not found final NIMMSTADeviceaddOrUpdateDevice(JsonObject json)Adds or updates NIMMSTADevice in devices final UnitremoveDevice(NIMMSTADevice device, Boolean removeFromGlobalDevices)Removes a specific device from the list of managed devices. final UnitremoveDevice(String address, Boolean removeFromGlobalDevices)Removes a device with the specified address from the list of managed devices. final Task<Unit>displayConnectActivity()Displays the connect activity to scan with a scanner final Task<Unit>searchForNimmstaDevices()Starts the search for scanners. final Task<Unit>cancelSearch()Cancels the search for scanners final Task<Unit>searchForLightTags()Starts the search for light tagsImplement the NIMMSTAManagerEventHandler to get notified about found light tags final Task<Unit>stopSearchForLightTags()Cancels the search for light tags final Task<NIMMSTADevice>connectToAddress(String address, Integer scanTimeout)Tries to connect to a device with the given address Can be canceled with cancelConnect final Task<NIMMSTADevice>connectToConnectionCode(String connectionCode, Integer scanTimeout)Tries to connect to a device with the given connection code Can be canceled with cancelConnect final Task<Unit>cancelConnect(String addressOrCode)Cancels a specific ongoing connect attempt with the given connectionCode or address final Task<Unit>cancelAllConnect()Cancels all ongoing connect attempts final Task<GetConnectionCodeResponse>getConnectionCode()Gets a new connection code from the NIMMSTA App final Task<Boolean>canChangeCompatibilityMode()Gets info if compatibility mode can be changed. final Task<Unit>changeBluetoothCompatibilityMode(Boolean active)Gets and sets compatibility mode. final Task<Unit>setAppInBackgroundScreen(String xmlString, Map<String, String> parameters)Sets a custom layout to be displayed on the NIMMSTA device when the app is in the background. final Task<Unit>setAppInBackgroundScreen(NIMMSTALayout nimmstaLayout)Sets a custom layout to be displayed on the NIMMSTA device when the app is in the background. final Task<Unit>setDesiredLightTags(List<String> lightTags)Sets the desired light tags, associating each tag with the default illumination configuration. final Task<Unit>setDesiredLightTags(List<String> lightTags, LightTagIlluminationConfig config)Sets the desired light tags with the specified illumination configuration. final Task<Unit>setDesiredLightTags(List<String> lightTags, LTColor color, Integer intensity, LTBlinkingPattern pattern)Sets the desired light tags with a specific illumination configuration. final Task<Unit>setDesiredLightTagsWithMacAddress(List<String> macAddresses)Sets the desired light tags associated with the specified MAC addresses, applying the default illumination configuration for each light tag. final Task<Unit>setDesiredLightTagsWithMacAddress(List<String> macAddresses, LightTagIlluminationConfig config)Sets the desired light tags associated with the given MAC addresses, applying the specified illumination configuration to each tag. final Task<Unit>setDesiredLightTagsWithMacAddress(List<String> macAddresses, LTColor color, Integer intensity, LTBlinkingPattern pattern)Sets the desired light tags for the specified devices, identified by their MAC addresses, applying the given illumination configuration settings which include color, intensity, and blinking pattern. final Task<Unit>attachLightTag(String macAddress, String location)Associates a light tag with a specific location on a device, identified by its MAC address. final Task<Unit>detachLightTag(String macAddress)Detaches a light tag associated with a specific MAC address. -
-
Method Detail
-
getDevices
final List<NIMMSTADevice> getDevices()
-
getConnectedDevices
final List<NIMMSTADevice> getConnectedDevices()
-
getSettings
final ManagerSettings getSettings()
Stores and manages the current settings of the NIMMSTAManager.
When updated, the new settings are automatically sent to the NIMMSTA app using the
sendConnectionManagerSettingsmethod. This ensures that changes to the manager's configuration are propagated as needed.The
settingsobject holds information such as whether multiple devices are allowed and whether the button is interpreted as a motion trigger.
-
setSettings
final Unit setSettings(ManagerSettings settings)
-
getAllowMultiDevice
final Boolean getAllowMultiDevice()
-
setAllowMultiDevice
final Unit setAllowMultiDevice(Boolean allowMultiDevice)
-
getInterpretButtonAsMotionTrigger
final Boolean getInterpretButtonAsMotionTrigger()
-
setInterpretButtonAsMotionTrigger
final Unit setInterpretButtonAsMotionTrigger(Boolean interpretButtonAsMotionTrigger)
-
getIsActive
final Boolean getIsActive()
-
getInitialManagerInfos
final Task<Unit> getInitialManagerInfos()
Initial request after creation to get devices and settings
-
getDeviceWithAddress
final NIMMSTADevice getDeviceWithAddress(String address)
Tries to return the device with the given address null if not found
-
addOrUpdateDevice
final NIMMSTADevice addOrUpdateDevice(JsonObject json)
Adds or updates NIMMSTADevice in devices
-
removeDevice
final Unit removeDevice(NIMMSTADevice device, Boolean removeFromGlobalDevices)
Removes a specific device from the list of managed devices.
- Parameters:
device- The NIMMSTADevice to be removed.
-
removeDevice
final Unit removeDevice(String address, Boolean removeFromGlobalDevices)
Removes a device with the specified address from the list of managed devices.
- Parameters:
address- The address of the device to be removed.
-
displayConnectActivity
final Task<Unit> displayConnectActivity()
Displays the connect activity to scan with a scanner
-
searchForNimmstaDevices
final Task<Unit> searchForNimmstaDevices()
Starts the search for scanners.
Implement the NIMMSTAManagerEventHandler to get notified about found scanners
-
cancelSearch
final Task<Unit> cancelSearch()
Cancels the search for scanners
-
searchForLightTags
final Task<Unit> searchForLightTags()
Starts the search for light tags
Implement the NIMMSTAManagerEventHandler to get notified about found light tags
-
stopSearchForLightTags
final Task<Unit> stopSearchForLightTags()
Cancels the search for light tags
-
connectToAddress
final Task<NIMMSTADevice> connectToAddress(String address, Integer scanTimeout)
Tries to connect to a device with the given address Can be canceled with cancelConnect
- Parameters:
address- Address to connect toscanTimeout- timeout in ms until scanning is stopped
-
connectToConnectionCode
final Task<NIMMSTADevice> connectToConnectionCode(String connectionCode, Integer scanTimeout)
Tries to connect to a device with the given connection code Can be canceled with cancelConnect
- Parameters:
connectionCode- Connection code to connect toscanTimeout- timeout in ms until scanning is stopped
-
cancelConnect
final Task<Unit> cancelConnect(String addressOrCode)
Cancels a specific ongoing connect attempt with the given connectionCode or address
- Parameters:
addressOrCode- The address or connectionCode used to start the attempt
-
cancelAllConnect
final Task<Unit> cancelAllConnect()
Cancels all ongoing connect attempts
-
getConnectionCode
final Task<GetConnectionCodeResponse> getConnectionCode()
Gets a new connection code from the NIMMSTA App
-
canChangeCompatibilityMode
final Task<Boolean> canChangeCompatibilityMode()
Gets info if compatibility mode can be changed.
-
changeBluetoothCompatibilityMode
final Task<Unit> changeBluetoothCompatibilityMode(Boolean active)
Gets and sets compatibility mode. Please check canChangeCompatibilityMode if can be changed.
- Parameters:
active- If compatibility mode should be turned on or off
-
setAppInBackgroundScreen
final Task<Unit> setAppInBackgroundScreen(String xmlString, Map<String, String> parameters)
Sets a custom layout to be displayed on the NIMMSTA device when the app is in the background.
The layout is defined using the provided XML string and additional parameters, if any.
- Parameters:
xmlString- A string representing the XML layout definition for the background screen.parameters- An optional map of key-value pairs used to configure the layout with additional data.
-
setAppInBackgroundScreen
final Task<Unit> setAppInBackgroundScreen(NIMMSTALayout nimmstaLayout)
Sets a custom layout to be displayed on the NIMMSTA device when the app is in the background.
- Parameters:
nimmstaLayout- The layout to display, represented by a NIMMSTALayout instance containing the layout string and optional parameters for additional customization.
-
setDesiredLightTags
final Task<Unit> setDesiredLightTags(List<String> lightTags)
Sets the desired light tags, associating each tag with the default illumination configuration.
- Parameters:
lightTags- A list of light tag identifiers to be modified.
-
setDesiredLightTags
final Task<Unit> setDesiredLightTags(List<String> lightTags, LightTagIlluminationConfig config)
Sets the desired light tags with the specified illumination configuration.
- Parameters:
lightTags- A list of identifiers for the light tags to be modified.config- The illumination configuration to apply to the specified light tags.
-
setDesiredLightTags
final Task<Unit> setDesiredLightTags(List<String> lightTags, LTColor color, Integer intensity, LTBlinkingPattern pattern)
Sets the desired light tags with a specific illumination configuration.
- Parameters:
lightTags- A list of identifiers for the light tags to be modified.color- The color of the light tag, represented by LTColor.intensity- The brightness level of the light tag, with a default value provided by LightTagIlluminationConfig.Default.pattern- The blinking pattern of the light tag, with a default value provided by LightTagIlluminationConfig.Default.
-
setDesiredLightTagsWithMacAddress
final Task<Unit> setDesiredLightTagsWithMacAddress(List<String> macAddresses)
Sets the desired light tags associated with the specified MAC addresses, applying the default illumination configuration for each light tag.
- Parameters:
macAddresses- A list of MAC addresses representing the devices whose light tags should be modified.
-
setDesiredLightTagsWithMacAddress
final Task<Unit> setDesiredLightTagsWithMacAddress(List<String> macAddresses, LightTagIlluminationConfig config)
Sets the desired light tags associated with the given MAC addresses, applying the specified illumination configuration to each tag.
- Parameters:
macAddresses- A list of MAC addresses representing the devices whose light tags should be modified.config- The illumination configuration to apply to the specified light tags.
-
setDesiredLightTagsWithMacAddress
final Task<Unit> setDesiredLightTagsWithMacAddress(List<String> macAddresses, LTColor color, Integer intensity, LTBlinkingPattern pattern)
Sets the desired light tags for the specified devices, identified by their MAC addresses, applying the given illumination configuration settings which include color, intensity, and blinking pattern.
- Parameters:
macAddresses- A list of MAC addresses representing the devices whose light tags should be modified.color- The color of the light tag, represented by LTColor.intensity- The brightness level of the light tag.pattern- The blinking pattern of the light tag.
-
attachLightTag
final Task<Unit> attachLightTag(String macAddress, String location)
Associates a light tag with a specific location on a device, identified by its MAC address.
- Parameters:
macAddress- The MAC address of the target device to which the light tag will be attached.location- The location or area on the device where the light tag will be placed.
-
detachLightTag
final Task<Unit> detachLightTag(String macAddress)
Detaches a light tag associated with a specific MAC address.
- Parameters:
macAddress- The MAC address of the device from which the light tag will be detached.
-
-
-
-