Package com.pi4j.io.w1
Class W1Master
- java.lang.Object
-
- com.pi4j.io.w1.W1Master
-
public class W1Master extends Object
- Author:
- Peter Schuebl
-
-
Constructor Summary
Constructors Constructor Description W1Master()
Create an instance of the W1 master.W1Master(ClassLoader classloader)
Create an instance of the W1 master.W1Master(String masterDir)
Create a master with a different default dir e.g.W1Master(String masterDir, ClassLoader classloader)
Create a master with a different default dir e.g.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkDeviceChanges()
<T extends W1Device>
TgetDeviceById(String id)
Get a single device by it's ID stringList<String>
getDeviceIDs()
Gets a list of all registered slave device ids.List<W1Device>
getDevices()
Get the list of available devices.<T extends W1Device>
List<T>getDevices(int deviceFamilyId)
<T> List<T>
getDevices(Class<T> type)
Get a list of devices that implement a certain interface.Map<String,W1DeviceType>
getDeviceTypeMap()
Collection<W1DeviceType>
getDeviceTypes()
Gets a list of the available device types.<T extends W1Device>
List<T>getW1Devices(Class<T> type)
String
toString()
-
-
-
Constructor Detail
-
W1Master
public W1Master()
Create an instance of the W1 master. Typically there should only be one master. java.util.ServiceLoader is used to add device support for individual devices.
-
W1Master
public W1Master(ClassLoader classloader)
Create an instance of the W1 master. Typically there should only be one master. java.util.ServiceLoader is used to add device support for individual devices.- Parameters:
classloader
- This ClassLoader will be used for the ServiceLoader to determine supported device types.
-
W1Master
public W1Master(String masterDir)
Create a master with a different default dir e.g. for tests.- Parameters:
masterDir
-
-
W1Master
public W1Master(String masterDir, ClassLoader classloader)
Create a master with a different default dir e.g. for tests.- Parameters:
masterDir
-classloader
- This ClassLoader will be used for the ServiceLoader to determine supported device types.
-
-
Method Detail
-
checkDeviceChanges
public void checkDeviceChanges()
-
getDeviceTypes
public Collection<W1DeviceType> getDeviceTypes()
Gets a list of the available device types.- Returns:
-
getDeviceTypeMap
public Map<String,W1DeviceType> getDeviceTypeMap()
-
getDeviceIDs
public List<String> getDeviceIDs()
Gets a list of all registered slave device ids.- Returns:
- list of slave ids, can be empty, never null.
-
getDevices
public List<W1Device> getDevices()
Get the list of available devices.- Returns:
- returns an unmodifiable list of W1Devices.
-
getDeviceById
public <T extends W1Device> T getDeviceById(String id)
Get a single device by it's ID string- Parameters:
id
- (string)- Returns:
- W1 device instance
-
getDevices
public <T> List<T> getDevices(Class<T> type)
Get a list of devices that implement a certain interface.- Type Parameters:
T
-- Parameters:
type
-- Returns:
-
-