001package com.github.sarxos.webcam.ds.dummy; 002 003import java.awt.Dimension; 004import java.awt.image.BufferedImage; 005import java.util.concurrent.atomic.AtomicBoolean; 006 007import com.github.sarxos.webcam.WebcamDevice; 008import com.github.sarxos.webcam.WebcamException; 009 010 011public class WebcamDummyDevice implements WebcamDevice { 012 013 private AtomicBoolean open = new AtomicBoolean(false); 014 015 @Override 016 public String getName() { 017 // TODO Auto-generated method stub 018 return null; 019 } 020 021 @Override 022 public Dimension[] getResolutions() { 023 // TODO Auto-generated method stub 024 return null; 025 } 026 027 @Override 028 public Dimension getResolution() { 029 // TODO Auto-generated method stub 030 return null; 031 } 032 033 @Override 034 public void setResolution(Dimension size) { 035 // TODO Auto-generated method stub 036 037 } 038 039 @Override 040 public BufferedImage getImage() { 041 042 if (!isOpen()) { 043 throw new WebcamException("Webcam is not open"); 044 } 045 046 return null; 047 } 048 049 @Override 050 public void open() { 051 if (open.compareAndSet(false, true)) { 052 // dodne 053 } 054 } 055 056 @Override 057 public void close() { 058 if (open.compareAndSet(true, false)) { 059 // dood 060 } 061 } 062 063 @Override 064 public void dispose() { 065 close(); 066 } 067 068 @Override 069 public boolean isOpen() { 070 return open.get(); 071 } 072}