Skip to content

Commit 0268bb2

Browse files
committed
Fixes the CameraSettings arguments
1 parent 6115fde commit 0268bb2

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

sdk/tools/cli-tool/src/main/java/esa/mo/nmf/clitool/PlatformCommands.java

+16-10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
* @author marcel.mikolajko
5151
*/
5252
public class PlatformCommands {
53+
5354
static Logger LOGGER = Logger.getLogger(PlatformCommands.class.getName());
5455

5556
@Command(name = "gps", subcommands = {GetNMEASentence.class})
@@ -66,6 +67,7 @@ public static class Camera {
6667

6768
@Command(name = "take-picture", description = "Take a picture from the camera")
6869
public static class TakePicture extends BaseCommand implements Runnable {
70+
6971
@Option(names = {"-res", "--resolution"}, paramLabel = "<resolution>", required = true,
7072
description = "Resolution of the image in format widthxheigh. For example 1920x1080")
7173
String resolution;
@@ -109,17 +111,20 @@ public void run() {
109111
}
110112

111113
String[] res = resolution.split("x");
112-
CameraSettings settings = new CameraSettings(new PixelResolution(new UInteger(Integer.parseInt(res[0])),
113-
new UInteger(Integer.parseInt(res[1]))), PictureFormat.fromString(format.toUpperCase()), new Duration(
114-
Double.parseDouble(exposure)), Float.parseFloat(gainRed), Float.parseFloat(gainGreen), Float
115-
.parseFloat(gainBlue));
114+
CameraSettings settings = new CameraSettings(
115+
new PixelResolution(new UInteger(Integer.parseInt(res[0])), new UInteger(Integer.parseInt(res[1]))),
116+
PictureFormat.fromString(format.toUpperCase()),
117+
new Duration(Double.parseDouble(exposure)),
118+
Float.parseFloat(gainRed), Float.parseFloat(gainGreen), Float.parseFloat(gainBlue),
119+
null
120+
);
116121

117122
final Object lock = new Object();
118123
try {
119124
camera.takePicture(settings, new CameraAdapter() {
120125
@Override
121126
public void takePictureResponseReceived(MALMessageHeader msgHeader, Picture picture,
122-
Map qosProperties) {
127+
Map qosProperties) {
123128
System.out.println("Picture received: " + picture);
124129
try {
125130
filename = filename + "." + format.toLowerCase();
@@ -136,7 +141,7 @@ public void takePictureResponseReceived(MALMessageHeader msgHeader, Picture pict
136141

137142
@Override
138143
public void takePictureResponseErrorReceived(MALMessageHeader msgHeader, MALStandardError error,
139-
Map qosProperties) {
144+
Map qosProperties) {
140145
LOGGER.log(Level.SEVERE, "Error during takePicture!", error);
141146
synchronized (lock) {
142147
lock.notifyAll();
@@ -172,6 +177,7 @@ public void takePictureResponseErrorReceived(MALMessageHeader msgHeader, MALStan
172177

173178
@Command(name = "get-status", description = "Gets the provider status")
174179
public static class GetStatus extends BaseCommand implements Runnable {
180+
175181
@Override
176182
public void run() {
177183
if (!super.initRemoteConsumer()) {
@@ -215,8 +221,9 @@ public void run() {
215221

216222
@Command(name = "get-nmea-sentence", description = "Gets the NMEA sentence")
217223
public static class GetNMEASentence extends BaseCommand implements Runnable {
224+
218225
@Parameters(arity = "1", paramLabel = "<sentenceIdentifier>", index = "0",
219-
description = "Identifier of the sentence")
226+
description = "Identifier of the sentence")
220227
String sentenceId;
221228

222229
@Override
@@ -239,7 +246,7 @@ public void run() {
239246
gps.getNMEASentence(sentenceId, new GPSAdapter() {
240247
@Override
241248
public void getNMEASentenceResponseReceived(MALMessageHeader msgHeader, String sentence,
242-
Map qosProperties) {
249+
Map qosProperties) {
243250
System.out.println("Sentence received: " + sentence);
244251

245252
synchronized (lock) {
@@ -249,7 +256,7 @@ public void getNMEASentenceResponseReceived(MALMessageHeader msgHeader, String s
249256

250257
@Override
251258
public void getNMEASentenceResponseErrorReceived(MALMessageHeader msgHeader, MALStandardError error,
252-
Map qosProperties) {
259+
Map qosProperties) {
253260
LOGGER.log(Level.SEVERE, "Error during getNMEASentence!", error);
254261
synchronized (lock) {
255262
lock.notifyAll();
@@ -266,4 +273,3 @@ public void getNMEASentenceResponseErrorReceived(MALMessageHeader msgHeader, MAL
266273
}
267274
}
268275
}
269-
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)