gobravia

package module
v0.0.0-...-c90469a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2017 License: MIT Imports: 10 Imported by: 0

README

Build Status

gobravia

Library to controll an Bravia (2014)

Parameters

gobravia.GetBravia
name description
IP IP of Bravia
PIN PIN for remote configuration
MAC MAC address of host
gobravia.Poweron
name description
Broadcast Broadcast of network

commands

The commands stored in an map, the key is an alias (e.g. up, down, num1).

{
  "<alias>": "<command>"
}

The commands can be read by this

bravia = gobravia.GetBravia("10.0.0.11", "0000", "FC:F1:52:F6:FA:8F")
bravia.GetCommands()

and can be printed to stdout with

bravia.PrintCodes()
Send Commands

The command can be send either by the command or by the alias.

bravia.SendCommand(command)
bravia.SendAlias(alias)

example

The commands stored in an map, the key is an alias (e.g. up, down, num1).

package main

import (
  "github.com/czerwe/gobravia"
)

func main() {
  bravia = gobravia.GetBravia("10.0.0.11", "0000", "FC:F1:52:F6:FA:8F")
	bravia.GetCommands()
  
  bravia.Poweron("10.0.0.255")

  bravia.SendCommand(command)
  
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BraviaTV

type BraviaTV struct {
	Address   string
	Envelope  Envelope
	Pin       string
	Mac       string
	Commands  map[string]string
	Connected bool
}

func GetBravia

func GetBravia(address string, pin string, mac string) *BraviaTV

func (*BraviaTV) GetCommands

func (tv *BraviaTV) GetCommands() bool

func (*BraviaTV) Poweron

func (tv *BraviaTV) Poweron(bcast string)

func (*BraviaTV) PrintCodes

func (tv *BraviaTV) PrintCodes()

func (*BraviaTV) SearchCode

func (tv *BraviaTV) SearchCode(code string) (string, bool)

func (*BraviaTV) SendAlias

func (tv *BraviaTV) SendAlias(alias string) bool

func (*BraviaTV) SendCommand

func (tv *BraviaTV) SendCommand(code string)

type CodeResponse

type CodeResponse struct {
	ID        int               `json:"id"`
	RawResult []json.RawMessage `json:"result"`
	Header    *Header           `json:"-"`
	Values    []*Value          `json:"-"`
}

type ComGet

type ComGet struct {
	Id      int      `json:"id"`
	Method  string   `json:"method"`
	Version string   `json:"version"`
	Params  []string `json:"params"`
}

type Envelope

type Envelope struct {
	XMLName       xml.Name `xml:"s:Envelope"`
	EncodingStyle string   `xml:"s:encodingStyle,attr"`
	Xmlns         string   `xml:"xmlns:s,attr"`
	SendIRCC      SendIRCC `xml:"s:Body>u:X_SendIRCC"`
}

func (*Envelope) GetRequestXML

func (envelope *Envelope) GetRequestXML(code string) ([]byte, error)
type Header struct {
	Bundled bool   `json:"bundled"`
	Type    string `json:"type"`
}

type SendIRCC

type SendIRCC struct {
	XMLName  xml.Name `xml:"u:X_SendIRCC"`
	Xmlns    string   `xml:"xmlns:u,attr"`
	IRCCCode string   `xml:"IRCCCode"`
}

type Tv

type Tv interface {
	GetCommands() bool
	SendCommand(code string)
}

type Value

type Value struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL