001 package com.github.sarxos.webcam.ds.ipcam;
002
003 import java.util.Collections;
004 import java.util.List;
005
006 import com.github.sarxos.webcam.WebcamDevice;
007 import com.github.sarxos.webcam.WebcamDriver;
008
009
010 /**
011 * IP camera driver.
012 *
013 * @author Bartosz Firyn (SarXos)
014 */
015 public class IpCamDriver implements WebcamDriver {
016
017 public IpCamDriver() {
018 this(null);
019 }
020
021 public IpCamDriver(IpCamStorage storage) {
022 if (storage != null) {
023 storage.open();
024 }
025 }
026
027 @Override
028 public List<WebcamDevice> getDevices() {
029 return Collections.unmodifiableList((List<? extends WebcamDevice>) IpCamDeviceRegistry.getIpCameras());
030 }
031
032 public void register(IpCamDevice device) {
033 IpCamDeviceRegistry.register(device);
034 }
035
036 public void unregister(IpCamDevice device) {
037 IpCamDeviceRegistry.unregister(device);
038 }
039
040 @Override
041 public boolean isThreadSafe() {
042 return true;
043 }
044
045 @Override
046 public String toString() {
047 return getClass().getSimpleName();
048 }
049 }