Documentation
¶
Index ¶
- Constants
- func WithFile(opt *ProgramOptions)
- type ActionData
- type ActionResponse
- type ActionResponseResult
- type ApiToken
- type ApitTokenResponse
- type CreateApiTokenRequest
- type DeviceContext
- type DeviceInfo
- type DeviceInformationResponse
- type DeviceProgramInstances
- type EditApiTokenRequest
- type HttpResponseError
- type IpTableDevice
- type IpTableEntry
- type IpTablePrograms
- type IpTableResponse
- type LibraryContext
- type ProgramDeleteResult
- type ProgramEntry
- type ProgramInstance
- type ProgramInstanceLibrary
- type ProgramInstanceResponse
- type ProgramInstances
- type ProgramLibraryResponse
- type ProgramOptions
- type ProgramOptsFunc
- type ProgramUploadResult
- type Programs
- type ProgramsContext
- type ProgramsLibrary
- type Room
- type RoomCreatedResult
- type RoomOptions
- type RoomStatus
- type Rooms
- type ServerError
- type TokenStatus
- type VC
- func (v *VC) Config() *VirtualConfig
- func (v *VC) CreateAndRunProgram(progOps *ProgramOptions, roomOps *RoomOptions) (result RoomCreatedResult, err VirtualControlError)
- func (v *VC) CreateProgram(options ProgramOptions) (result ProgramUploadResult, err VirtualControlError)
- func (v *VC) CreateRoom(options RoomOptions) (RoomCreatedResult, VirtualControlError)
- func (v *VC) CreateToken(readonly bool, description string) (ApiToken, VirtualControlError)
- func (v *VC) DebugRoom(id string, enable bool) (bool, VirtualControlError)
- func (v *VC) DeleteProgram(id int) (result ProgramDeleteResult, err VirtualControlError)
- func (v *VC) DeleteRoom(id string) VirtualControlError
- func (v *VC) DeleteToken(token string) (bool, VirtualControlError)
- func (v *VC) DeviceInfo() (DeviceInfo, VirtualControlError)
- func (v *VC) EditProgram(options ProgramOptions) (result ProgramUploadResult, err VirtualControlError)
- func (v *VC) EditRoom(options RoomOptions) (RoomCreatedResult, VirtualControlError)
- func (v *VC) EditToken(readonly bool, description string, token string) (ApiToken, VirtualControlError)
- func (v *VC) GetIpTable(roomId string) ([]IpTableEntry, VirtualControlError)
- func (v *VC) GetPrograms() (Programs, VirtualControlError)
- func (v *VC) GetRooms() (Rooms, VirtualControlError)
- func (v *VC) GetTokens() ([]ApiToken, VirtualControlError)
- func (v *VC) RestartRoom(id string) (bool, VirtualControlError)
- func (v *VC) StartRoom(id string) (bool, VirtualControlError)
- func (v *VC) StopRoom(id string) (bool, VirtualControlError)
- type VcApiToken
- type VcInfoApi
- type VcIpTableApi
- type VcProgramApi
- type VcRoomApi
- type VirtualConfig
- type VirtualControl
- type VirtualControlError
Constants ¶
const (
DEVICEINFO = "DeviceInfo"
)
const (
IPTABLEBYID = "IpTableByPID"
)
const (
LOCALHOSTURL string = "http://127.0.0.1:5000/"
)
const (
PROGRAMLIBRARY = "ProgramLibrary"
)
const (
TOKENREQUEST = "Token"
)
Variables ¶
This section is empty.
Functions ¶
func WithFile ¶
func WithFile(opt *ProgramOptions)
Types ¶
type ActionData ¶
type ActionData[T any] struct { Operation string `json:"Operation"` Results []ActionResponseResult[T] `json:"Results"` TargetObject string `json:"TargetObject"` Version string `json:"Version"` }
type ActionResponse ¶
type ActionResponse[T any] struct { Actions []ActionData[T] `json:"Actions"` }
type ActionResponseResult ¶
type ApiToken ¶ added in v0.1.0
type ApiToken struct {
Token string `json:"Token"`
Status TokenStatus `json:"Status"`
Description string `json:"Description"`
Level string `json:"Level"`
}
type ApitTokenResponse ¶ added in v0.1.0
type ApitTokenResponse struct {
Device struct {
Programs struct {
TokenList []ApiToken `json:"TokenList"`
} `json:"Programs"`
} `json:"Device"`
}
type CreateApiTokenRequest ¶ added in v0.1.0
type CreateApiTokenRequest struct {
Description string `json:"Description"`
Status TokenStatus `json:"Status"`
}
type DeviceContext ¶
type DeviceContext struct {
DeviceInfo DeviceInfo `json:"DeviceInfo"`
}
type DeviceInfo ¶
type DeviceInfo struct {
ID string `json:"ID"`
Model string `json:"Model"`
Category string `json:"Category"`
Manufacturer string `json:"Manufacturer"`
DeviceID string `json:"DeviceId"`
Name string `json:"Name"`
ApplicationVersion string `json:"ApplicationVersion"`
BuildDate string `json:"BuildDate"`
DeviceKey string `json:"DeviceKey"`
MACAddress string `json:"MacAddress"`
Version string `json:"Version"`
PythonVersion string `json:"PythonVersion"`
MonoVersion string `json:"MonoVersion"`
}
type DeviceInformationResponse ¶
type DeviceInformationResponse struct {
Device DeviceContext `json:"Device"`
}
type DeviceProgramInstances ¶
type DeviceProgramInstances struct {
Programs ProgramInstances `json:"Programs"`
}
type EditApiTokenRequest ¶ added in v0.1.0
type EditApiTokenRequest struct {
Description string `json:"Description"`
Status TokenStatus `json:"Status"`
Token string `json:"Token"`
}
type HttpResponseError ¶
type HttpResponseError struct {
StatusCode int
}
Stores an invalid HTTP response as a status code.
func NewResponseError ¶
func NewResponseError(code int) *HttpResponseError
func (HttpResponseError) Error ¶
func (code HttpResponseError) Error() string
type IpTableDevice ¶ added in v0.0.8
type IpTableDevice struct {
IpTablePrograms `json:"Programs"`
}
type IpTableEntry ¶ added in v0.0.8
type IpTableEntry struct {
UniqueID int `json:"UniqueId"`
ProgramInstanceID string `json:"ProgramInstanceId"`
ProgramIPID int `json:"ProgramIpId"`
Model string `json:"Model"`
Description string `json:"Description"`
RemoteIP string `json:"remote_ip"`
Status string `json:"Status"`
DeviceType int `json:"device_type"`
MacAddress string `json:"MacAddress"`
DeviceID int `json:"DeviceId"`
Hostname string `json:"Hostname"`
SupportAssociation bool `json:"SupportAssociation"`
}
type IpTablePrograms ¶ added in v0.0.8
type IpTablePrograms struct {
IPTableByPID []IpTableEntry `json:"IpTableByPID"`
}
type IpTableResponse ¶ added in v0.0.8
type IpTableResponse struct {
IpTableDevice `json:"Device"`
}
type LibraryContext ¶
type LibraryContext struct {
Programs ProgramsContext `json:"Programs"`
}
type ProgramDeleteResult ¶
func NewProgramDeleteResult ¶
func NewProgramDeleteResult(actions *ActionResponse[any]) ProgramDeleteResult
type ProgramEntry ¶
type ProgramEntry struct {
ProgramID int16 `json:"ProgramId"`
FriendlyName string `json:"FriendlyName"`
Notes string `json:"Notes"`
AppFile string `json:"AppFile"`
AppFileTS string `json:"AppFileTS"`
MobilityFile string `json:"MobilityFile"`
MobilityFileTS string `json:"MobilityFileTS"`
WebxPanelFile string `json:"WebxPanelFile"`
WebxPanelFileTS string `json:"WebxPanelFileTS"`
ProjectFile string `json:"ProjectFile"`
ProjectFileTS string `json:"ProjectFileTS"`
CwsFile string `json:"CwsFile"`
CwsFileTS string `json:"CwsFileTS"`
ProgramType string `json:"ProgramType"`
ProgramName string `json:"ProgramName"`
CompileDateTime string `json:"CompileDateTime"`
CresDBVersion string `json:"CresDBVersion"`
DeviceDBVersion string `json:"DeviceDBVersion"`
IncludeDATVersion string `json:"IncludeDatVersion"`
}
type ProgramInstance ¶
type ProgramInstance struct {
ID int64 `json:"id"`
ProgramInstanceID string `json:"ProgramInstanceId"`
UserFile string `json:"UserFile"`
Status string `json:"Status"`
Name string `json:"Name"`
ProgramLibraryID int `json:"ProgramLibraryId"`
Level string `json:"Level"`
AddressSetsLocation bool `json:"AddressSetsLocation"`
Location string `json:"Location"`
Longitude string `json:"Longitude"`
Latitude string `json:"Latitude"`
TimeZone string `json:"TimeZone"`
ConfigurationLink string `json:"ConfigurationLink"`
XpanelURL string `json:"XpanelUrl"`
Notes string `json:"Notes"`
DebuggingEnabled bool `json:"DebuggingEnabled"`
}
type ProgramInstanceLibrary ¶
type ProgramInstanceLibrary map[string]ProgramInstance
type ProgramInstanceResponse ¶
type ProgramInstanceResponse struct {
Device DeviceProgramInstances `json:"Device"`
}
type ProgramInstances ¶
type ProgramInstances struct {
ProgramInstanceLibrary ProgramInstanceLibrary `json:"ProgramInstanceLibrary"`
}
type ProgramLibraryResponse ¶
type ProgramLibraryResponse struct {
Device LibraryContext `json:"Device"`
}
type ProgramOptions ¶
type ProgramOptsFunc ¶
type ProgramOptsFunc func(*ProgramOptions)
type ProgramUploadResult ¶
type ProgramUploadResult struct {
ProgramID int16
FriendlyName string
Result string
Code int16
Success bool
}
func NewProgramUploadResult ¶
func NewProgramUploadResult(actions *ActionResponse[ProgramEntry]) ProgramUploadResult
type Programs ¶
type Programs []ProgramEntry
type ProgramsContext ¶
type ProgramsContext struct {
ProgramLibrary ProgramsLibrary `json:"ProgramLibrary"`
}
type ProgramsLibrary ¶
type ProgramsLibrary map[string]ProgramEntry
type Room ¶
type Room struct {
ID string
Name string
Status string
Debugging bool
Location string
Longitude string
Latitude string
TimeZone string
ConfigurationLink string
XpanelURL string
Notes string
ProgramID int16 `json:"ProgramId"`
ProgramName string `json:"ProgramName"`
ProgramFriendly string `json:"FriendlyName"`
ProgramType string `json:"ProgramType"`
CompileDateTime string `json:"CompileDateTime"`
}
This is the actual model used by the TUI. This model includes all the information we need about a room and the program it is running.
func NewRoom ¶
func NewRoom(i ProgramInstance, p ProgramEntry) Room
type RoomCreatedResult ¶ added in v0.0.3
type RoomOptions ¶ added in v0.0.3
type RoomOptions struct {
Name string
ProgramInstanceId string
ProgramLibraryId int
Notes string
Level string
Location string
TimeZone string
Latitude string
Longitude string
AddressSetsLocation bool
UserFile string
}
func NewRoomOptions ¶ added in v0.0.3
func NewRoomOptions(programId int, id string, name string) RoomOptions
type RoomStatus ¶
type RoomStatus string
const ( Running RoomStatus = "Running" Aborted RoomStatus = "Aborted" Stopped RoomStatus = "Stopped" Stopping RoomStatus = "Stopping" Starting RoomStatus = "Starting" PROGRAMINSTANCES = "ProgramInstance" )
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
func NewServerError ¶
func NewServerError(code int, err error) *ServerError
func (*ServerError) Error ¶
func (e *ServerError) Error() string
type TokenStatus ¶ added in v0.1.0
type TokenStatus int
const ( ReadOnlyToken TokenStatus = 1 ReadWriteToken TokenStatus = 2 )
type VC ¶
type VC struct {
// contains filtered or unexported fields
}
func (*VC) CreateAndRunProgram ¶ added in v0.0.5
func (v *VC) CreateAndRunProgram(progOps *ProgramOptions, roomOps *RoomOptions) (result RoomCreatedResult, err VirtualControlError)
func (*VC) CreateProgram ¶
func (v *VC) CreateProgram(options ProgramOptions) (result ProgramUploadResult, err VirtualControlError)
func (*VC) CreateRoom ¶ added in v0.0.3
func (v *VC) CreateRoom(options RoomOptions) (RoomCreatedResult, VirtualControlError)
func (*VC) CreateToken ¶ added in v0.1.0
func (v *VC) CreateToken(readonly bool, description string) (ApiToken, VirtualControlError)
func (*VC) DeleteProgram ¶
func (v *VC) DeleteProgram(id int) (result ProgramDeleteResult, err VirtualControlError)
func (*VC) DeleteRoom ¶ added in v0.0.3
func (v *VC) DeleteRoom(id string) VirtualControlError
func (*VC) DeleteToken ¶ added in v0.1.0
func (v *VC) DeleteToken(token string) (bool, VirtualControlError)
func (*VC) DeviceInfo ¶
func (v *VC) DeviceInfo() (DeviceInfo, VirtualControlError)
func (*VC) EditProgram ¶ added in v0.0.3
func (v *VC) EditProgram(options ProgramOptions) (result ProgramUploadResult, err VirtualControlError)
func (*VC) EditRoom ¶ added in v0.0.3
func (v *VC) EditRoom(options RoomOptions) (RoomCreatedResult, VirtualControlError)
func (*VC) GetIpTable ¶ added in v0.0.8
func (v *VC) GetIpTable(roomId string) ([]IpTableEntry, VirtualControlError)
func (*VC) GetPrograms ¶
func (v *VC) GetPrograms() (Programs, VirtualControlError)
func (*VC) GetRooms ¶
func (v *VC) GetRooms() (Rooms, VirtualControlError)
func (*VC) GetTokens ¶ added in v0.1.0
func (v *VC) GetTokens() ([]ApiToken, VirtualControlError)
func (*VC) RestartRoom ¶
func (v *VC) RestartRoom(id string) (bool, VirtualControlError)
type VcApiToken ¶ added in v0.1.0
type VcApiToken interface {
GetTokens() ([]ApiToken, VirtualControlError)
CreateToken(readonly bool, description string) (ApiToken, VirtualControlError)
EditToken(readonly bool, description string, token string) (ApiToken, VirtualControlError)
DeleteToken(token string) (bool, VirtualControlError)
}
type VcInfoApi ¶
type VcInfoApi interface {
DeviceInfo() (DeviceInfo, VirtualControlError)
}
type VcIpTableApi ¶ added in v0.0.8
type VcIpTableApi interface {
GetIpTable(roomId string) ([]IpTableEntry, VirtualControlError)
}
type VcProgramApi ¶
type VcProgramApi interface {
GetPrograms() (Programs, VirtualControlError)
CreateProgram(options ProgramOptions) (result ProgramUploadResult, err VirtualControlError)
EditProgram(options ProgramOptions) (result ProgramUploadResult, err VirtualControlError)
DeleteProgram(id int) (result ProgramDeleteResult, err VirtualControlError)
CreateAndRunProgram(progOps *ProgramOptions, roomOps *RoomOptions) (result RoomCreatedResult, err VirtualControlError)
}
type VcRoomApi ¶
type VcRoomApi interface {
GetRooms() (Rooms, VirtualControlError)
StartRoom(id string) (bool, VirtualControlError)
StopRoom(id string) (bool, VirtualControlError)
DebugRoom(id string, enable bool) (bool, VirtualControlError)
RestartRoom(id string) (bool, VirtualControlError)
CreateRoom(options RoomOptions) (RoomCreatedResult, VirtualControlError)
EditRoom(options RoomOptions) (RoomCreatedResult, VirtualControlError)
DeleteRoom(id string) VirtualControlError
}
type VirtualConfig ¶
type VirtualConfig struct {
// contains filtered or unexported fields
}
type VirtualControl ¶
type VirtualControl interface {
Config() *VirtualConfig
VcProgramApi
VcInfoApi
VcRoomApi
VcIpTableApi
VcApiToken
}
The virtual control server will need to be controlled one of two ways:
- https with a authorization header - http local host without auth.
Controlling local host : -- requires the /VirtualControl/config/api/ be removed from the route -- Local host port 5000 -- use http NOT https
Controlling external: -- full path urls https://[ServerURL]/VirtualControl/config/api/ -- use of https, I'm not writing this for unsecured servers. -- accept self signed certs, this si way too common not too! -- header "Authorization: [Token]"
func NewRemoteVC ¶
func NewRemoteVC(host string, token string) VirtualControl
type VirtualControlError ¶
type VirtualControlError interface {
Error() string
}