displaycloud

package
v0.0.0-...-3f2acf5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2014 License: BSD-2-Clause Imports: 7 Imported by: 3

Documentation

Overview

displaycloud provides basic functionality to interact with the DisplayCloud "middleware".

The displaycloud package is used by mrclean to interact with the DislpayCloud middleware. It provides the basic functionalities to marshal and unmarshal the JSONRPC messages to be sent via websocket. It connects to DisplayCloud and do handle all the calls to adding, soerting and grouping new visuals. There is a stub for the handling of events coming from other sources, e.g. if someone move a visual from another client we got a event but we ignore it so far.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Display Display
	// contains filtered or unexported fields
}

func Dial

func Dial(url string) (*Client, error)

func (*Client) AddVisual

func (cli *Client) AddVisual(vis mrclean.Visual) (*Visual, error)

func (*Client) SetVisualsOrigin

func (cli *Client) SetVisualsOrigin(vids []int, poss [][]float64) error

type Display

type Display struct {
	Origin       []float64 `json:"origin,omitempty"`
	Description  string    `json:"description,omitempty"`
	Name         string    `json:"name,omitempty"`
	DPI          []float64 `json:"dpi,omitempty"`
	ID           int       `json:"id,omitempty"`
	SizeDiscrete []int     `json:"sizeDiscret,omitempty"`
	Size         []float64 `json:"size,omitempty"`
	HostName     string    `json:"hostname,omitempty"`
	Visible      bool      `json:"visible,omitempty"`
}

{"origin": [0.0, 0.0], "description": "7x4 tiled 1024x768 displays", "hostname": "rocksvv.local", "visible": true, "dpi": [35.28756407422915, 35.28756407422915], "size": [5.1595287115033655, 2.2112265906442996], "id": 29, "sizeDiscrete": [7168, 3072], "name": "IfI display wall"}

type Event

type Event struct {
	Type    string                 `json:"event_type"`
	Version string                 `json:"dc_event"`
	Data    map[string]interface{} `json:"event_data"`
}

{"event_type": "object_property_changed", "dc_event": "1.0", "event_data": {"new_value": [0.05526591049184404, 0.018044854873855876], "obj_type": "visual", "property_name": "origin", "obj_id": 38}}

type MessIn

type MessIn struct {
	*Event
	*RpcRes
}

type RpcErr

type RpcErr struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type RpcReq

type RpcReq struct {
	Version string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	ID      int         `json:"id"`
	Params  interface{} `json:"params"`
}

JSON RPC Request

func AddVisual

func AddVisual(v *Visual) RpcReq

/json_rpc_call('add_visual', [{ 'name' : 'saturn', 'origin' : [0.0, 0.0], 'size_discrete' : [3536,1399], 'dpi_hint' : [70.0,70.0], 'type' : 'pic', 'pic_url' : 'http://tellus-demo.local/td-pics/saturn2.jpg', 'pic_geometry' : [3536,1399] }]) """Adds a visual to the cloud display.

@param info dictionary with info about the visual. Keys:
    name: name of visual (optional, default '')
    description: descriptive text (optional, default '')
    origin: (x,y) initial center point of the visual in the cloud
        display
    size: (w,h) initial width and height, in m (optional)
    size_discrete: (w,h) initial width and height, in
        pixels (optional)
    dpi_hint: (x,y) initial pixel density, in dpi (optional)
    type: 'null', 'vnc', or 'pic'.

    Either size, or size_discrete and dpi_hint must be given.

    Depending on the type, there are more keys. For null,
   there are none. For vnc:
        vnc_server: vnc server url (str)
        enc_passwd: encrypted password (str)
        vnc_geometry: (w,h) width and height of framebuffer,
            in pixels
    For pic:
        pic_url: http url for picture
        pic_geometry: (w,h) width and height of pic, in pixels

@return nothing. An event is issued when the visual has been
added.
"""

func DisplayGroupInfo

func DisplayGroupInfo() RpcReq

/json_rpc_call('displaygroups_get_info', [])

func DisplaysInfo

func DisplaysInfo() RpcReq

/json_rpc_call('displays_get_info', [])

func MoveVisuals

func MoveVisuals(vids, dids, gids []int) RpcReq

/json_rpc_call('move_selected_visuals', [[42, 39], [], [29]])

"""moves the visuals onto either one display or one displaygroup.
  @param visual_ids list of visual ids (length > 0)
  @param display_ids list of display ids (length <= 1)
  @param displaygroup_ids list of displaygroup ids (length <= 1)
  """

func SetOrigin

func SetOrigin(vid int, x, y float64) RpcReq

/json_rpc_call('visual_set_origin', [39, [0.0, 0.0]])

func SetScale

func SetScale(vid int, x, y float64) RpcReq

/json_rpc_call('visual_scale', [42, [2.0, 2.0]])

func SetVisualOrigin

func SetVisualOrigin(vid int, norigin []float64) RpcReq

def visual_set_origin(self, vid, new_origin) :

with self._lock :
    visual = self._visuals[vid].space_tree_node
    origin_vec = Vec2D(new_origin[0], new_origin[1])
    acked(visual.setOrigin, origin_vec)

func VisualInfo

func VisualInfo(vid int) RpcReq

/json_rpc_call('visual_get_info', [])

func VisualsInfo

func VisualsInfo() RpcReq

/json_rpc_call('visuals_get_info', [])

type RpcRes

type RpcRes struct {
	Version string `json:"jsonrpc"`
	ID      int    `json:"id"`
	//Result  interface{} `json:"result"`
	Result json.RawMessage `json:"result"`
	Error  *RpcErr         `json:"error"`
}

JSON RPC Result

type Visual

type Visual struct {
	Origin          []float64 `json:"origin,omitempty"`
	Description     string    `json:"description,omitempty"`
	Name            string    `json:"name,omitempty"`
	Type            string    `json:"type,omitempty"`
	ID              int       `json:"id,omitempty"`
	DPI             []float64 `json:"dpi,omitempty"`
	SizeDiscreteBug []int     `json:"sizeDiscrete,omitempty"`
	SizeDiscrete    []int     `json:"size_discrete,omitempty"`
	Size            []float64 `json:"size,omitempty"`
	VNCServer       string    `json:"vnc_server,omitempty"`
	DPIHint         []float64 `json:"dpi_hint,omitempty"`
	PicGeometry     []float64 `json:"pic_geometry,omitempty"`
	URL             string    `json:"pic_url,omitempty"`
	//rect             Rectangle `json:"-"`
	mrclean.MetaData `json:"-"`
}

func NewPicVisual

func NewPicVisual(name, description, url string, size []float64) *Visual

func (*Visual) Rect

func (v *Visual) Rect() image.Rectangle

Rect returns an image.Ractangle

Jump to

Keyboard shortcuts

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