Skip to content

Commit 552c247

Browse files
committed
Adds support to non-fixed camera resolutions
1 parent 227289f commit 552c247

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

core/mo-services-impl/nmf-platform-generic-impl/src/main/java/esa/mo/platform/impl/provider/gen/CameraAdapterInterface.java

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ public interface CameraAdapterInterface {
4141
*/
4242
boolean isUnitAvailable();
4343

44+
/**
45+
* @return true if the camera has only a fixed set of resolutions. They can
46+
* then be retrieved with the getAvailableResolutions() method.
47+
*/
48+
boolean hasFixedResolutions();
49+
4450
/**
4551
* @return The resolutions supported by the Camera Adapter
4652
*/

core/mo-services-impl/nmf-platform-generic-impl/src/main/java/esa/mo/platform/impl/provider/gen/CameraProviderServiceImpl.java

+16-13
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class CameraProviderServiceImpl extends CameraInheritanceSkeleton {
100100
public synchronized void init(COMServicesProvider comServices,
101101
CameraAdapterInterface adapter) throws MALException {
102102
long timestamp = System.currentTimeMillis();
103-
103+
104104
if (!initialiased) {
105105
if (MALContextFactory.lookupArea(MALHelper.MAL_AREA_NAME, MALHelper.MAL_AREA_VERSION) == null) {
106106
MALHelper.init(MALContextFactory.getElementFactoryRegistry());
@@ -216,20 +216,23 @@ private void isCapturePossible(final CameraSettings settings) throws MALInteract
216216
PlatformHelper.DEVICE_IN_USE_ERROR_NUMBER, null));
217217
}
218218
final PixelResolutionList availableResolutions = adapter.getAvailableResolutions();
219-
boolean isResolutionAvailable = false;
220219

221-
// Do we have the resolution requested?
222-
for (PixelResolution availableResolution : availableResolutions) {
223-
if (settings.getResolution().equals(availableResolution)) {
224-
isResolutionAvailable = true;
225-
break;
220+
if (adapter.hasFixedResolutions()) {
221+
boolean isResolutionAvailable = false;
222+
223+
// Do we have the resolution requested?
224+
for (PixelResolution availableResolution : availableResolutions) {
225+
if (settings.getResolution().equals(availableResolution)) {
226+
isResolutionAvailable = true;
227+
break;
228+
}
226229
}
227-
}
228230

229-
// If not, then send the available resolutions to the consumer so they can pick...
230-
if (!isResolutionAvailable) {
231-
throw new MALInteractionException(new MALStandardError(
232-
COMHelper.INVALID_ERROR_NUMBER, availableResolutions));
231+
// If not, then send the available resolutions to the consumer so they can pick...
232+
if (!isResolutionAvailable) {
233+
throw new MALInteractionException(new MALStandardError(
234+
COMHelper.INVALID_ERROR_NUMBER, availableResolutions));
235+
}
233236
}
234237

235238
boolean isFormatsAvailable = false;
@@ -360,7 +363,7 @@ public GetPropertiesResponse getProperties(MALInteraction interaction) throws
360363
}
361364

362365
@Override
363-
public void preprocessPicture(Picture inputPicture, CameraSettings settings,
366+
public void preprocessPicture(Picture inputPicture, CameraSettings settings,
364367
PreprocessPictureInteraction interaction) throws MALInteractionException, MALException {
365368
throw new UnsupportedOperationException("Not supported yet.");
366369
}

mission/simulator/platform-services-impl/src/main/java/esa/mo/platform/impl/provider/softsim/CameraSoftSimAdapter.java

+5
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,9 @@ public boolean isUnitAvailable()
191191
return pcAdapter.isDeviceEnabled(DeviceType.CAMERA);
192192
}
193193

194+
@Override
195+
public boolean hasFixedResolutions()
196+
{
197+
return true;
198+
}
194199
}

0 commit comments

Comments
 (0)