Running Multiple Commands in Sequence
Running http commands in sequence
Use http.Client instead of http.post to keep connection open.
The documentation for the Dart http package has the following advice:
If you’re making multiple requests to the same server, you can keep open a persistent connection by using a Client rather than making one-off requests. If you do this, make su...
List Options Example
Get Options
The camera options you want to get need to be specified individually in an array.
I do not think you can get all the options with a wildcard or “all” specification.
Format of the data request is below.
var url ='http://192.168.1.1/osc/commands/execute';
Map data = {
'name': 'camera.getOptions',
'parameters': {
'op...
List Files Example
List Files
https://api.ricoh/docs/theta-web-api-v2.1/commands/camera.list_files/
This shows a more complex nested payload with parameters.
Request
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:apitest/pretty_print.dart';
Future<http.Response> listFiles() async {
var url = 'http:...
Take Picture Example
Take Picture Example
If you send a payload such as {'name': 'camera.takePicture'} as part of your
request, you must encode the body as JSON. You can use json.encode(your-payload-object)
or the new jsonEncode() https://api.dart.dev/stable/2.7.1/dart-convert/jsonEncode.html
Test from THETA SC2. OK!
Response from SC2 shown below.
C:\Users...
Basic POST Example - No Payload
Instead of info, you can also use other commands:
Example with state
$ dart bin/main.dart state
{
"fingerprint": "FIG_0001",
"state": {
"batteryLevel": 0.8,
"storageUri": "http://192.168.1.1/files/thetasc26c21a247d9055838792badc5",
"_apiVersion": 2,
"_batteryState": "charged",
"_cameraError": [],
"_captureStatus": "...
Reasons to Use Dart
Growth of Dart
According to GitHub’s The State of the Octoverse, Dart was the fastest growing language in 2019,
growing faster than Go, Rust, and TypeScript.
The interest in Dart is largely driven by Flutter.
JAXenter readers also ranked Dart as the most relevant language of 2019.
The IEEE SPECTRUM ranking puts Dart in the top 10 of
tre...
Bug in SC2 Preview Format header
There is a bug in the preview format. The preview still works.
In my tests, there are significant differences between the THETA V options
and the options for SC2. In your tests, you can try each option individually
to see what is supported.
Note that in the test of the SC2 below, the previewFormat is not returning
the correct values.
The p...
Checking if image is ready for download
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:apitest/pretty_print.dart';
Future<http.Response> status(id) async {
var url = 'http://192.168.1.1/osc/commands/status';
Map data = {'id': id};
//encode Map to JSON
var body = jsonEncode(data);
var response = await http.post(ur...
26 post articles, 3 pages.