Connect the wireless LAN between THETA and the smartphone that runs on the application using this Theta Client.
import THETAClient
// Create ThetaRepository object by specifying an IP address
ThetaRepository.Companion.shared.doNewInstance(
endPoint:"http://<THETA IP ADDRESS>"
) {response, error in
if let instance = response {
theta = instance
}
if let thetaError = error {
// handle error
}
}
Mode | Address |
---|---|
Direct mode | 192.168.1.1 |
Other | Assigned IP address |
Signing & Capabilities
->App Transport Security Exception
can also be added.<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<http://www.apple.com/DTDs/PropertyList-1.0.dtd>">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>192.168.1.1</key>
<dict>
<key>NSIncludesSubdomain</key>
<false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>
First, use ThetaRepository.getPhotoCaptureBuilder()
to set the shooting and create the PhotoCapture
object.
Task {
do {
let photoCapture: PhotoCapture = try await withCheckedThrowingContinuation {continuation in
PhotoCaptureBuilder()
.setIsoAutoHighLimit(iso: ThetaRepository.IsoAutoHighLimitEnum.iso1000)
.setFileFormat(fileFormat: ThetaRepository.PhotoFileFormat.image5k)
.build {capture, error in
if let photoCapture = capture {
continuation.resume(returning: photoCapture)
}
if let thetaError = error {
continuation.resume(throwing: thetaError)
}
}
}
} catch {
// catch thetaError
}
}
The above example sets the maximum ISO sensitivity to 1000 and the file format to image5k.
See View preview for instructions on how to view preview.
Then we call PhotoCapture.takePicture(callback:)
to shoot still pictures. Create and call a callback class that implements PhotoCaptureTakePictureCallback
as follows.
do {
class Callback: PhotoCaptureTakePictureCallback {
let callback: (_ fileUrl: String?, _ error: Error?) -> Void
init(_ callback: @escaping (_ fileUrl: String?, _ error: Error?) -> Void) {
self.callback = callback
}
func onSuccess(fileUrl: String) {
callback(fileUrl, nil)
}
func onError(exception: ThetaRepository.ThetaRepositoryException) {
callback(nil, exception as? Error)
}
}
let fileUrl: String = try await withCheckedThrowingContinuation {continuation in
photoCapture.takePicture(
callback: Callback {fileUrl, error in
if let photoUrl = fileUrl {
continuation.resume(returning: photoUrl)
}
if let thetaError = error {
continuation.resume(throwing: thetaError)
}
}
)
}
// send GET request for fileUrl and receive a JPEG file
} catch {
// catch error while take picture
}
setExposureCompensation(value:ThetaRepository.ExposureCompensationEnum)
Value | Correction value | Remarks |
---|---|---|
m20 | -2.0f | |
m17 | -1.7f | |
m13 | -1.0f | |
m07 | -0.7f | |
m03 | -0.3f | |
zero | 0.0f | |
p03 | 0.3f | |
p07 | 0.7f | |
p13 | 1.0f | |
p17 | 1.7f | |
p20 | 2.0f |
setExposureDelay(delay:ThetaRepository.ExposureDelayEnum)
Delay between the takePicture command and the start of exposure (= self-timer).