00001 #ifndef FCAM_N900_LENS_H 00002 #define FCAM_N900_LENS_H 00003 00007 #include "../Lens.h" 00008 #include "../CircularBuffer.h" 00009 #include "../Time.h" 00010 #include <vector> 00011 00012 namespace FCam { namespace N900 { 00013 00017 class Lens : public FCam::Lens { 00018 00019 public: 00020 Lens(); 00021 ~Lens(); 00022 00023 void setFocus(float, float speed); 00024 float getFocus(); 00025 00027 float farFocus() {return 0.0f;} 00028 00030 float nearFocus() {return 20.0f;} 00031 bool focusChanging(); 00032 float minFocusSpeed(); 00033 float maxFocusSpeed(); 00034 00035 // setFocus takes about 350us, so I'll guess the lens starts moving halfway through 00036 int focusLatency() {return 175;} 00037 00038 void setZoom(float, float) {} 00040 float getZoom() {return 5.2f;} 00041 float minZoom() {return 5.2f;} 00042 float maxZoom() {return 5.2f;} 00043 bool zoomChanging() {return false;} 00044 float minZoomSpeed() {return 0;} 00045 float maxZoomSpeed() {return 0;} 00046 int zoomLatency() {return 0;} 00047 00048 void setAperture(float, float) {} 00050 float getAperture() {return 2.8f;} 00051 float wideAperture(float) {return 2.8f;} 00052 float narrowAperture(float) {return 2.8f;} 00053 bool apertureChanging() {return false;} 00054 int apertureLatency() {return 0;} 00055 float minApertureSpeed() {return 0.0f;} 00056 float maxApertureSpeed() {return 0.0f;} 00057 00058 void tagFrame(FCam::Frame *f); 00059 00063 float getFocus(Time t); 00064 00065 private: 00066 00067 int ioctlSet(unsigned key, int val); 00068 int ioctlGet(unsigned key); 00069 00070 float ticksToDiopters(int); 00071 int dioptersToTicks(float); 00072 float tickRateToDiopterRate(int); 00073 int diopterRateToTickRate(float); 00074 00075 struct LensState { 00076 Time time; 00077 float position; 00078 }; 00079 CircularBuffer<LensState> lensHistory; 00080 }; 00081 00082 }} 00083 00084 #endif
1.5.6