Skip to content

Commit e77821d

Browse files
committed
Support new DAL iterator format
1 parent 454918b commit e77821d

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
env:
10-
VERSION_PREFIX: 3.2.${{ github.run_number }}
10+
VERSION_PREFIX: 3.3.${{ github.run_number }}
1111
VERSION_REV: ${{ github.run_attempt }}
1212
VERSION_SUFFIX: +${{ github.sha }}
1313
BUILD_CONF: Release

ZWOptical.SDK.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</ItemGroup>
5252

5353
<ItemGroup>
54-
<PackageReference Include="TianWen.DAL" Version="1.2.61" />
54+
<PackageReference Include="TianWen.DAL" Version="1.2.81" />
5555
</ItemGroup>
5656

5757
</Project>

include/ASICamera2.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,40 @@ public BayerPattern BayerPattern
182182

183183
public IReadOnlyList<int> SupportedBins => _supportedBins;
184184

185+
public IReadOnlyList<PixelDataFormat> SupportedPixelDataFormats
186+
{
187+
get
188+
{
189+
var list = new List<PixelDataFormat>(_supportedVideoFormat.Length);
190+
191+
for (var i = 0; i < _supportedVideoFormat.Length; i++)
192+
{
193+
if (_supportedVideoFormat[i] is ASI_IMG_TYPE.ASI_IMG_END)
194+
{
195+
break;
196+
}
197+
198+
PixelDataFormat format;
199+
switch (_supportedVideoFormat[i])
200+
{
201+
case ASI_IMG_TYPE.ASI_IMG_RAW8: format = PixelDataFormat.RAW8; break;
202+
case ASI_IMG_TYPE.ASI_IMG_RGB24: format = PixelDataFormat.RGB24; break;
203+
case ASI_IMG_TYPE.ASI_IMG_RAW16: format = PixelDataFormat.RAW16; break;
204+
case ASI_IMG_TYPE.ASI_IMG_Y8: format = PixelDataFormat.Y8; break;
205+
default: throw new NotSupportedException($"Unsupported image type: {_supportedVideoFormat[i]}");
206+
}
207+
208+
list[i] = format;
209+
}
210+
211+
return list;
212+
}
213+
}
214+
185215
public bool HasMechanicalShutter => _mechanicalShutter is ASI_BOOL.ASI_TRUE;
186216

217+
public bool HasCooler => _isCoolerCam is ASI_BOOL.ASI_TRUE;
218+
187219
public bool HasST4Port => _st4Port is ASI_BOOL.ASI_TRUE;
188220

189221
public int MaxWidth => _maxWidth;

include/DeviceIterator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,33 @@ protected override int DeviceCount()
2929
return 0;
3030
}
3131

32-
protected override (int? DeviceId, TDeviceInfo? DeviceInfo) GetId(int index)
32+
protected override TDeviceInfo? GetDeviceInfo(int index)
3333
{
3434
if (typeof(TDeviceInfo) == typeof(ASI_CAMERA_INFO))
3535
{
3636
if (ASIGetCameraProperty(out var camInfo, index) is ASI_SUCCESS)
3737
{
38-
return (camInfo.ID, (TDeviceInfo)(INativeDeviceInfo)camInfo);
38+
return (TDeviceInfo)(INativeDeviceInfo)camInfo;
3939
}
4040
}
4141
else if (typeof(TDeviceInfo) == typeof(EAF_INFO))
4242
{
4343
if (EAFGetID(index, out var eafId) is EAF_SUCCESS
4444
&& EAFGetProperty(eafId, out var eafInfo) is EAF_SUCCESS && eafInfo.ID == eafId)
4545
{
46-
return (eafInfo.ID, (TDeviceInfo)(INativeDeviceInfo)eafInfo);
46+
return (TDeviceInfo)(INativeDeviceInfo)eafInfo;
4747
}
4848
}
4949
else if (typeof(TDeviceInfo) == typeof(EFW_INFO))
5050
{
5151
if (EFWGetID(index, out var efwId) is EFW_SUCCESS
5252
&& EFWGetProperty(efwId, out var efwInfo) is EFW_SUCCESS && efwInfo.ID == efwId)
5353
{
54-
return (efwInfo.ID, (TDeviceInfo)(INativeDeviceInfo)efwInfo);
54+
return (TDeviceInfo)(INativeDeviceInfo)efwInfo;
5555
}
5656
}
5757

58-
return (null, null);
58+
return null;
5959
}
6060
}
6161
}

0 commit comments

Comments
 (0)