Commit 1d066ae1 authored by a's avatar a
Browse files

setting ISO

parent 675e0fb3
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -54,17 +54,36 @@ get_token() {
shoot() {
	echo '{"msg_id":4864,"token":'$TOKEN'}'

	get_JSON # "capture was enqueued"
	get_JSON # await "capture was enqueued"

	get_JSON 128 # "capture has finished"
	get_JSON 128 # await "capture has finished"
	echo "$RESPONSE" | grep '"msg_id":8193' >/dev/null # assert "capture has finished" message id
	CAPTURED_FNAME=$(echo "$RESPONSE" | sed 's/.*"param":"//; s/".*//') # extract filename
	echo "Captured $CAPTURED_FNAME" >&2
}

set_ISO() {
	[ $# -eq 1 ] || {
		echo 'Usage: set_ISO <Auto|value>' >&2
		false
	}

	ISO="$1"

	case "$ISO" in
		Auto|auto) ISO=0;;
		50|100|200|400|800|1600);;
		*) echo "Invalid ISO" >&2; return 1;;
	esac

	echo '{"param":"'$ISO'","msg_id":5172,"btwifi":2,"token":'$TOKEN'}'
	get_JSON # await "ISO was set"
}

# Commands to run on the camera
commander() {
	get_token
	set_ISO 50
	shoot
}