001    package com.github.sarxos.webcam.ds.ipcam.device.marmitek;
002    
003    import java.net.MalformedURLException;
004    import java.net.URL;
005    
006    import com.github.sarxos.webcam.WebcamException;
007    import com.github.sarxos.webcam.ds.ipcam.IpCamDevice;
008    import com.github.sarxos.webcam.ds.ipcam.IpCamMode;
009    
010    
011    public class IPRobocam641 extends IpCamDevice {
012    
013            private URL base = null;
014    
015            public IPRobocam641(String name, String urlBase) {
016                    this(name, toURL(urlBase));
017            }
018    
019            public IPRobocam641(String name, URL base) {
020                    super(name, (URL) null, IpCamMode.PUSH);
021                    this.base = base;
022            }
023    
024            @Override
025            public URL getURL() {
026                    String url = String.format("%s/cgi/mjpg/mjpg.cgi", base);
027                    try {
028                            return new URL(url);
029                    } catch (MalformedURLException e) {
030                            throw new WebcamException(String.format("Incorrect URL %s", url), e);
031                    }
032            }
033    
034    }