本文整理汇总了C#中CameraControl.Devices.Classes.DeviceDescriptor类的典型用法代码示例。如果您正苦于以下问题:C# DeviceDescriptor类的具体用法?C# DeviceDescriptor怎么用?C# DeviceDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceDescriptor类属于CameraControl.Devices.Classes命名空间,在下文中一共展示了DeviceDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public bool Init(DeviceDescriptor deviceDescriptor,DeviceDescription description)
{
base.Init(deviceDescriptor);
StillImageDevice imageDevice = StillImageDevice as StillImageDevice;
if (imageDevice != null)
imageDevice.DeviceEvent += StillImageDevice_DeviceEvent;
foreach (var property in description.Properties)
{
if (!string.IsNullOrEmpty(property.Name))
{
try
{
MTPDataResponse result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc, property.Code);
ErrorCodes.GetException(result.ErrorCode);
uint dataType = BitConverter.ToUInt16(result.Data, 2);
int dataLength = StaticHelper.GetDataLength(dataType);
var value = new PropertyValue<long> { Code = property.Code, Name = property.Name };
foreach (var propertyValue in property.Values)
{
value.AddValues(propertyValue.Name, propertyValue.Value);
}
value.ValueChanged += value_ValueChanged;
AdvancedProperties.Add(value);
}
catch (Exception ex)
{
Log.Error("Error ger property ", ex);
}
}
}
return true;
}
示例2: Main
static void Main(string[] args)
{
EepromChecko();
return;
string camid = FindNikonCamera();
if (camid == "")
{
Debug.WriteLine("** Failed to find Nikon Camera");
Console.WriteLine("Failed to find Nikon Camera");
return;
}
SN = camid.Split('#')[2];
DeviceDescriptor descriptor = new DeviceDescriptor { WpdId = camid };
cam = new BaseMTPCamera();
bool i = cam.Init(descriptor);
var rep = cam.ExecuteReadDataEx(MTP_OPERATION_GET_DEVICE_INFO);
if (rep.ErrorCode == ErrorCodes.MTP_OK)
{
//DumpTests();
Dump_Eeprom_LANG_Test1(SN);
}
}
示例3: Connect
public DeviceDescriptor Connect(string address)
{
string ip = address;
if (address.Contains(":"))
{
ip = address.Split(':')[0];
int port;
int.TryParse(address.Split(':')[1], out port);
}
PtpIpClient client = new PtpIpClient();
if (!client.Open(ip, 15740))
throw new Exception("No server was found!");
PtpIpProtocol protocol = new PtpIpProtocol(client);
protocol.ExecuteWithNoData(0x1002, 1);
if (CameraDeviceManager.GetNativeDriver(protocol.Model) != null)
{
DeviceDescriptor descriptor = new DeviceDescriptor {WpdId = "ptpip"};
var cameraDevice = (ICameraDevice)Activator.CreateInstance(CameraDeviceManager.GetNativeDriver(protocol.Model));
descriptor.StillImageDevice = protocol;
descriptor.CameraDevice = cameraDevice;
//cameraDevice.SerialNumber = StaticHelper.GetSerial(portableDevice.DeviceId);
cameraDevice.Init(descriptor);
return descriptor;
}
else
{
throw new Exception("Not Supported device " + protocol.Model);
}
}
示例4: Connect
public DeviceDescriptor Connect(string address)
{
int port = 4757;
string ip = address;
if (address.Contains(":"))
{
ip = address.Split(':')[0];
int.TryParse(address.Split(':')[1], out port);
}
DdClient client = new DdClient();
if (!client.Open(ip, port))
throw new Exception("No server was found!");
var devices = client.GetDevices();
if (devices.Count == 0)
throw new Exception("No connected device was found!");
client.Connect(devices[0]);
DdServerProtocol protocol = new DdServerProtocol(client);
if (CameraDeviceManager.GetNativeDriver(protocol.Model) != null)
{
DeviceDescriptor descriptor = new DeviceDescriptor { WpdId = "ddserver" };
var cameraDevice = (ICameraDevice)Activator.CreateInstance(CameraDeviceManager.GetNativeDriver(protocol.Model));
descriptor.StillImageDevice = protocol;
//cameraDevice.SerialNumber = StaticHelper.GetSerial(portableDevice.DeviceId);
cameraDevice.Init(descriptor);
descriptor.CameraDevice = cameraDevice;
return descriptor;
}
else
{
throw new Exception("Not Supported device " + protocol.Model);
}
}
示例5: Init
public override bool Init(DeviceDescriptor deviceDescriptor)
{
bool res = base.Init(deviceDescriptor);
Capabilities.Clear();
Capabilities.Add(CapabilityEnum.CaptureNoAf);
HaveLiveView = false;
CaptureInSdRam = false;
return res;
}
示例6: Init
public override bool Init(DeviceDescriptor deviceDescriptor)
{
bool res = base.Init(deviceDescriptor);
Capabilities.Clear();
Capabilities.Add(CapabilityEnum.LiveView);
Capabilities.Add(CapabilityEnum.RecordMovie);
Capabilities.Add(CapabilityEnum.CaptureInRam);
Capabilities.Add(CapabilityEnum.CaptureNoAf);
return res;
}
示例7: Init
public override bool Init(DeviceDescriptor deviceDescriptor)
{
bool res = base.Init(deviceDescriptor);
Capabilities.Clear();
Capabilities.Add(CapabilityEnum.LiveView);
Capabilities.Add(CapabilityEnum.RecordMovie);
CaptureInSdRam = false;
PropertyChanged -= NikonBase_PropertyChanged;
return res;
}
示例8: MenuItem_Click
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
DeviceInfo = new XmlDeviceData();
SelectDevice wnd = new SelectDevice();
wnd.ShowDialog();
if (wnd.DialogResult == true && wnd.SelectedDevice != null)
{
try
{
SelectedDevice = wnd.SelectedDevice;
DeviceDescriptor descriptor = new DeviceDescriptor {WpdId = SelectedDevice.DeviceId};
MtpProtocol device = new MtpProtocol(descriptor.WpdId);
device.ConnectToDevice("MTPTester", 1, 0);
descriptor.StillImageDevice = device;
MTPCamera = new BaseMTPCamera();
MTPCamera.Init(descriptor);
LoadDeviceData(MTPCamera.ExecuteReadDataEx(0x1001));
//LoadDeviceData(MTPCamera.ExecuteReadDataEx(0x9108));
PopulateProperties();
}
catch (DeviceException exception)
{
MessageBox.Show("Error getting device information" + exception.Message);
}
catch (Exception exception)
{
MessageBox.Show("General error" + exception.Message);
}
if (DefaultDeviceInfo != null)
{
foreach (XmlCommandDescriptor command in DeviceInfo.AvaiableCommands)
{
command.Name = DefaultDeviceInfo.GetCommandName(command.Code);
}
foreach (XmlEventDescriptor avaiableEvent in DeviceInfo.AvaiableEvents)
{
avaiableEvent.Name = DefaultDeviceInfo.GetEventName(avaiableEvent.Code);
}
foreach (XmlPropertyDescriptor property in DeviceInfo.AvaiableProperties)
{
property.Name = DefaultDeviceInfo.GetPropName(property.Code);
}
}
InitUi();
}
}
示例9: btn_get_value_Click
private void btn_get_value_Click(object sender, RoutedEventArgs e)
{
try
{
if (MTPCamera == null || MTPCamera.IsConnected == false)
{
DeviceInfo = new XmlDeviceData();
SelectDevice wnd = new SelectDevice();
wnd.ShowDialog();
if (wnd.DialogResult == true && wnd.SelectedDevice != null)
{
SelectedDevice = wnd.SelectedDevice;
DeviceDescriptor descriptor = new DeviceDescriptor {WpdId = SelectedDevice.DeviceId};
MTPCamera = new BaseMTPCamera();
MTPCamera.Init(descriptor);
}
else
{
return;
}
}
XmlPropertyDescriptor propertyDescriptor = lst_prop.SelectedItem as XmlPropertyDescriptor;
MTPDataResponse resp = MTPCamera.ExecuteReadDataEx(BaseMTPCamera.CONST_CMD_GetDevicePropValue,
propertyDescriptor.Code);
long val = GetValue(resp, 0, GetDataLength(propertyDescriptor.DataType));
XmlPropertyValue selected = null;
foreach (XmlPropertyValue xmlPropertyValue in propertyDescriptor.Values)
{
if (xmlPropertyValue.Value == val)
selected = xmlPropertyValue;
}
if(selected!=null)
{
lst_values.BeginInit();
lst_values.SelectedItem = selected;
lst_values.EndInit();
}
}
catch (Exception exception)
{
MessageBox.Show("Error to get value " + exception.Message);
}
}
示例10: Init
public override bool Init(DeviceDescriptor deviceDescriptor)
{
base.Init(deviceDescriptor);
Properties.Add(InitFocalLength());
ExposureCompensation = new PropertyValue<int> {Available = false};
ExposureMeteringMode = new PropertyValue<int> {Available = false};
FNumber = new PropertyValue<int> {Available = false};
IsoNumber = new PropertyValue<int> {Available = false};
CompressionSetting = new PropertyValue<int> {Available = false};
Mode = new PropertyValue<uint>() {Available = false};
ShutterSpeed = new PropertyValue<long>() {Available = false};
WhiteBalance = new PropertyValue<long>() {Available = false};
FocusMode = new PropertyValue<long>() {Available = false};
StillImageDevice imageDevice = StillImageDevice as StillImageDevice;
if (imageDevice != null)
imageDevice.DeviceEvent += StillImageDevice_DeviceEvent;
return true;
}
示例11: Connect
public DeviceDescriptor Connect(string address)
{
int port = 7878;
string ip = address;
if (address.Contains(":"))
{
ip = address.Split(':')[0];
int.TryParse(address.Split(':')[1], out port);
}
YiCameraProtocol protocol = new YiCameraProtocol();
protocol.Connect(ip, port);
DeviceDescriptor descriptor = new DeviceDescriptor { WpdId = "YiCamera" };
var cameraDevice = new YiCamera();
descriptor.StillImageDevice = protocol;
descriptor.CameraDevice = cameraDevice;
//cameraDevice.SerialNumber = StaticHelper.GetSerial(portableDevice.DeviceId);
cameraDevice.Init(descriptor);
return descriptor;
}
示例12: Connect
public DeviceDescriptor Connect(string address)
{
CameraDiscovery cameraDiscover = new CameraDiscovery();
if (cameraDiscover.UDPSocketSetup())
{
if (cameraDiscover.MSearch())
{
var cameraResp = cameraDiscover.DeviceDescription();
var info = cameraDiscover.AnalyzeDescription(cameraResp);
var camera = new SonyWifiCamera();
camera.Init(info.Endpoints["camera"]);
camera.DeviceName = info.FriendlyName;
camera.SerialNumber = info.UDN;
DeviceDescriptor descriptor = new DeviceDescriptor { WpdId = "SonyWifiCamera" };
descriptor.CameraDevice = camera;
//cameraDevice.SerialNumber = StaticHelper.GetSerial(portableDevice.DeviceId);
return descriptor;
}
}
throw new Exception("No camera was found !");
}
示例13: Init
public override bool Init(DeviceDescriptor deviceDescriptor)
{
CurrentValues = new Dictionary<string, string>();
Capabilities.Add(CapabilityEnum.LiveView);
Capabilities.Add(CapabilityEnum.LiveViewStream);
Protocol = deviceDescriptor.StillImageDevice as YiCameraProtocol;
Protocol.DataReceiverd += Protocol_DataReceiverd;
DeviceName = Protocol.Model;
Manufacturer = Protocol.Manufacturer;
IsConnected = true;
CompressionSetting = new PropertyValue<int> { Tag = "photo_quality" };
Mode = new PropertyValue<uint> { Tag = "capture_mode" };
Mode.AddValues("Single", 0);
Mode.AddValues("Burst", 1);
Mode.AddValues("Delayed", 2);
//Mode.AddValues("TimeLapse", 3);
Mode.ReloadValues();
ExposureMeteringMode = new PropertyValue<int>() { Tag = "meter_mode" };
LiveViewImageZoomRatio = new PropertyValue<int>();
LiveViewImageZoomRatio.AddValues("All", 0);
LiveViewImageZoomRatio.Value = "All";
SendCommand(3);
Thread.Sleep(500);
SerialNumber = GetValue("serial_number");
SetProperty(Mode.Tag, GetValue(Mode.Tag));
var thread = new Thread(LoadProperties) { Priority = ThreadPriority.Lowest };
thread.Start();
return true;
}
示例14: GetWiaIDevice
private ICameraDevice GetWiaIDevice(IDeviceInfo devInfo)
{
// if camera already is connected do nothing
if (_deviceEnumerator.GetByWiaId(devInfo.DeviceID) != null)
return _deviceEnumerator.GetByWiaId(devInfo.DeviceID).CameraDevice;
_deviceEnumerator.RemoveDisconnected();
DeviceDescriptor descriptor = new DeviceDescriptor {WiaDeviceInfo = devInfo, WiaId = devInfo.DeviceID};
ICameraDevice cameraDevice = new WiaCameraDevice();
bool isConnected = cameraDevice.Init(descriptor);
descriptor.CameraDevice = cameraDevice;
_deviceEnumerator.Add(descriptor);
ConnectedDevices.Add(cameraDevice);
if (isConnected)
{
NewCameraConnected(cameraDevice);
}
//ServiceProvider.DeviceManager.SelectedCameraDevice.ReadDeviceProperties(0);
return SelectedCameraDevice;
}
示例15: Init
public override bool Init(DeviceDescriptor deviceDescriptor)
{
try
{
IsBusy = true;
Capabilities.Add(CapabilityEnum.CaptureInRam);
Capabilities.Add(CapabilityEnum.CaptureNoAf);
StillImageDevice = deviceDescriptor.StillImageDevice;
// check if is mtp device
StillImageDevice imageDevice = StillImageDevice as StillImageDevice;
if (imageDevice != null)
imageDevice.DeviceEvent += _stillImageDevice_DeviceEvent;
HaveLiveView = true;
DeviceReady();
DeviceName = StillImageDevice.Model;
Manufacturer = StillImageDevice.Manufacturer;
IsConnected = true;
CaptureInSdRam = true;
PropertyChanged += NikonBase_PropertyChanged;
var ser = StillImageDevice.SerialNumber;
Log.Debug("Serial number" + ser ?? "");
if (ser != null && ser.Length >= 7)
{
SerialNumber = ser.Substring(0, 7);
// there in some cases the leading zero order differs
if (SerialNumber == "0000000")
{
SerialNumber = ser.Substring(ser.Length-7,7);
}
}
// load advanced properties in a separated thread to speed up camera connection
var thread = new Thread(LoadProperties) {Priority = ThreadPriority.Lowest};
thread.Start();
}
catch (Exception exception)
{
Log.Error("Error initialize device", exception);
}
return true;
}