Example #1
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}
	fileUri := "1"
	if len(os.Args) > 2 {
		fileUri = os.Args[2]
	}

	client, _ := osc.NewClient(host)

	getMetadataCommand := new(command.GetMetadataCommand)
	getMetadataCommand.Parameters.FileUri = &fileUri
	client.CommandExecute(getMetadataCommand)

	exif := getMetadataCommand.Results.Exif
	fmt.Println("Exif:")
	fmt.Println("  ExifVersion:", *exif.ExifVersion)
	fmt.Println("  ImageDescription:", *exif.ImageDescription)
	xmp := getMetadataCommand.Results.Xmp
	fmt.Println("XMP:")
	fmt.Println("  ProjectionType:", *xmp.ProjectionType)
	fmt.Println("  UsePanoramaViewer:", *xmp.UsePanoramaViewer)

}
Example #2
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}
	client, _ := osc.NewClient(host)

	command := new(command.ListImagesCommand)
	parameters := &command.Parameters

	entryCount, maxSize, includeThumb := 10, 10, true
	parameters.EntryCount = &entryCount
	parameters.MaxSize = &maxSize
	parameters.IncludeThumb = &includeThumb

	_, error := client.CommandExecute(command)
	if error != nil {
		fmt.Println("Error:", error)
		return
	}

	results := command.Results
	fmt.Println("totalEntries:", *results.TotalEntries)
	if *results.TotalEntries > 0 {
		entries := *results.Entries
		for i := range entries {
			fmt.Printf("{name: %s, uri: %s}\n", *entries[i].Name, *entries[i].Uri)
		}
	}

}
Example #3
0
func main() {

	host := "http://dummy-host"

	client, _ := osc.NewClient(host)
	_, error := client.Info()

	if error != nil {
		fmt.Println("Error:", error.Error())
	}
}
Example #4
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}

	client, _ := osc.NewClient(host)

	// camera.startSession
	startSessionCommand := new(command.StartSessionCommand)
	client.CommandExecute(startSessionCommand)

	fmt.Println("camera.startSession:")
	fmt.Println("  sessionId:", *startSessionCommand.Results.SessionId)
	sessionId := startSessionCommand.Results.SessionId

	// camera.takePicture
	takePictureCommand := new(command.TakePictureCommand)
	takePictureCommand.Parameters.SessionId = sessionId
	takePictureResponse, _ := client.CommandExecute(takePictureCommand)

	fmt.Println("camera.takePicture")
	fmt.Println("  state:", *takePictureResponse.State)
	fmt.Println("  commandId:", *takePictureResponse.Id)
	commandId := takePictureResponse.Id

	// camera.updateSession
	updateSessionCommand := new(command.UpdateSessionCommand)
	updateSessionCommand.Parameters.SessionId = sessionId
	updateSessionResponse, _ := client.CommandExecute(updateSessionCommand)

	fmt.Println("camera.updateaSession:")
	fmt.Println("  state:", *updateSessionResponse.State)
	sessionId = updateSessionCommand.Results.SessionId

	// camera.closeSession
	closeSessionCommand := new(command.CloseSessionCommand)
	closeSessionCommand.Parameters.SessionId = sessionId
	closeSessionResponse, _ := client.CommandExecute(closeSessionCommand)

	fmt.Println("camera.closeSession:")
	fmt.Println("  state:", *closeSessionResponse.State)

	// CommandStatus
	commandStatusResponse, _ := client.CommandStatus(*commandId, takePictureCommand)
	fmt.Println("CommandStatus:")
	fmt.Println("  state:", *commandStatusResponse.State)
	fmt.Println("  fileUri:", *takePictureCommand.Results.FileUri)
}
Example #5
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}

	client, _ := osc.NewClient(host)
	info, _ := client.Info()

	fmt.Println("manufacturer:", *info.Manufacturer)
	fmt.Println("model:", *info.Model)
	fmt.Println("serialNumber:", *info.SerialNumber)
	fmt.Println("firmwareVersion:", *info.FirmwareVersion)

}
Example #6
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}
	client, _ := osc.NewClient(host)

	res, _ := client.CheckForUpdates("test", nil)
	if res.StateFingerprint != nil {
		fmt.Println("fingerprint:", *res.StateFingerprint)
	}
	if res.ThrottleTimeout != nil {
		fmt.Println("throttleTimout:", *res.ThrottleTimeout)
	}

}
Example #7
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}
	fileUri := "1"
	if len(os.Args) > 2 {
		fileUri = os.Args[2]
	}

	client, _ := osc.NewClient(host)

	deleteCommand := new(command.DeleteCommand)
	deleteCommand.Parameters.FileUri = &fileUri
	response, _ := client.CommandExecute(deleteCommand)
	fmt.Println("state:", *response.State)
}
Example #8
0
func main() {

	host := "http://192.168.1.1"
	if len(os.Args) > 1 {
		host = os.Args[1]
	}
	fileUri := "1"
	if len(os.Args) > 2 {
		fileUri = os.Args[2]
	}

	client, _ := osc.NewClient(host)

	getImageCommand := new(command.GetImageCommand)
	getImageCommand.Parameters.FileUri = &fileUri
	response, _ := client.CommandExecute(getImageCommand)
	http_body := response.Results.(io.ReadCloser)
	defer http_body.Close()
	out, _ := os.Create(fileUri)
	defer out.Close()
	io.Copy(out, http_body)
}