Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Symetrix API SnippetsNew to Visual Studio Code? Get it now.
Symetrix API Snippets

Symetrix API Snippets

Symetrix

|
301 installs
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Symetrix

This extention allows for the snippet recall of Symetrix API's.

Snippet Triggers Include:

HTTP

HttpClient.Download {
   Url = "string",
   Headers = {table},
   User = "string",
   Password = "string",
   Timeout = "number",
   EventHandler = "function"}
HttpClient.Upload {
   Url = "string",
   Headers = {"table"},
   User = "string",
   Password = "string",
   Data = "string",
   Method = "string",
   Timeout = "number",
   EventHandler = "function"}
HttpClient.CreateUrl({
   Host = "string",
   Port = "number",
   Path = "string",
   Query = {"table"},
   Encode = "bool"})
HttpClient.EncodeParams({
   key = "value", ["valid key"] = "valid value"})
HttpClient.EncodeString("string", "bool")
HttpClient.DecodeString("string")

HTTP Framework

function Response(Table, ReturnCode, Data, Error, Headers)

   if debug then
      print(Data),
      print(Table),
      print(ReturnCode),
      print(Error),
      print(Headers),
   end
end

function Http_Request()

   Url = (HttpClient.CreateUrl({
      Host = "",
      Path = ""}))

   HttpClient.Upload({
      Url = Url,
      Headers = {""},
      Data = "",
      Method = "POST",
      EventHandler = Response})

   HttpClient.Download {
      Url = Url,
      Headers = {""},
      EventHandler = Response}
end

TCP

MyTcp = TcpSocket.New()
TcpSocketName.EventHandler(TcpSocket, event, error)
TcpSocketName.ReconnectTimeout
TcpSocketName.IsConnected
TcpSocketName.BufferLength
TcpSocketName:Connect(ip, port)
TcpSocketName:Disconnect()
TcpSocketName:Write(data)
TcpSocketName:Read(length)
TcpSocketName:ReadLine(EOL, [delimiter])
TcpSocketName:Search(pattern, [start])
sock = TcpSocket.New()

TCP Framework

sock.ReadTimeout = 0
sock.WriteTimeout = 0
sock.ReconnectTimeout = 0

sock.Connected = function(TcpSocket)
   print("socket connected\r")
end

sock.Reconnect = function(TcpSocket)
   print("socket reconnecting...\r")
end

sock.Data = function(TcpSocket, data)

rxLine = sock:Read(10000)
   if (nil ~= rxLine) then
      print("Got:\r" .. rxLine)
   end
end

sock.Closed = function(TcpSocket)
   print("socket closed by remote\r")
end

sock.Error = function(TcpSocket, error)
   print(string.format("Error: '%s'\r", error))
end

sock.Timeout = function(TcpSocket, error)
   print("socket closed due to timeout\r")
end

sock:Connect(remoteControlIp, remoteControlPort)

UDP

MyUdp = UdpSocket.New()
UdpSocketName:Open(ip, port)
UdpSocketName:Close()
UdpSocketName:Send(ip, port, data)
UdpSocketName:GetSockName()

UDP Framework

function HandleData(socket, packet)
    print("Socket ID: " .. socket.ID)
    receivedIP, receivedPort = socket:GetSockName()
    print("Socket IP: " .. receivedIP)
    print("Socket Port: " .. receivedPort)
    print("Packet IP: " .. packet.Address)
    print("Packet Port: " .. packet.Port)
    print("Packet Data: \r" .. packet.Data)
end

MyUdp = UdpSocket.New()
MyUdp:Open(Device.LocalUnit.ControlIP, 0)
MyUdp.Data = HandleData
MyUdp:Send("0.0.0.0", 48630, "CS 1 0\r\n")

SSH

Ssh.New()
SshName.EventHandler(Ssh, event, error)
SshName.ReconnectTimeout
SshName.IsConnected
SshName.IsInteractive
SshName.BufferLength
SshName.PublicKey
SshName.PrivateKey
SshName.PrivateKeyPassword
SshName:Connect(ip, port, username, password)
SshName:Disconnect()
SshName:Write(data)
SshName:Read(length)
SshName:ReadLine(EOL, [delimiter])
SshName:Search(pattern, [start])
SshName.LoginFailed(Ssh, error)
SshName.Connected(Ssh)
SshName.Reconnect(Ssh)
SshName.Data(Ssh, data)
SshName.Closed(Ssh)
SshName.Error(Ssh, error)
SshName.Timeout(Ssh, error)

SSH Framework

SSH = Ssh.New()
SSH.ReadTimeout = 15
SSH.WriteTimeout = 15
SSH.ReconnectTimeout = 10

function ParseResponse() -- function that reads the SSH TCP socket

    rx = SSH:Read(SSH.BufferLength) -- assign the contents of the buffer to a variable
    print(rx)
end

--#region SSH Callback
SSH.Connected = function() -- function called when the TCP socket is connected
    print("Socket connected")
end

SSH.Reconnect = function() -- function called when the TCP socket is reconnected
    print("Socket reconnecting...")
end

SSH.Closed = function() -- function called when the TCP socket is closed
    print("Socket closed")
end

SSH.Error = function() -- function called when the TCP socket has an error
    print("Socket error")
end

SSH.Timeout = function() -- function called when the TCP socket times out
    print("Socket timeout")
end

SSH.LoginFailed = function() -- function called when SSH login fails
    print("SSH login failed")
end

SSH.Data = ParseResponse -- ParseResponse is called when the SSH object has data

SSH:Write(" " .. "\r\n")

Timer

function TimerClick()

end

MyTimer = Timer.New()
MyTimer.EventHandler = TimerClick
MyTimer:Start(.25)

JSON

json.encode(object)
json.decode(jsonString, startPos)
json.null()

NamedControl

NamedControl.GetText(name)
NamedControl.SetText(name, value)
NamedControl.GetValue(name)
NamedControl.SetValue(name, value)
NamedControl.GetPosition(name)
NamedControl.SetPosition(name, position)

Controls

Controls.Inputs[input].Value
Controls.Inputs[input].EventHandler
Controls.Outputs[output].Value

Device

Device.Offline
Device.LocalUnit.ControlIP
Device.LocalUnit.AudioIP
Device.LocalUnit.Name
Device.LocalUnit.Type
Device.LocalUnit.TypeName
Device.RemoteUnit.IP
Device.RemoteUnit.Name
Device.RemoteUnit.Type
Device.RemoteUnit.TypeName
Device.RemoteUnit.DanteIP
Device.RemoteUnit.DanteMAC
Device.RemoteUnit.DanteName
Device.RemoteUnit.DanteModel
Device.RemoteUnit.DanteMfg

Born out of a recording studio in 1976, Symetrix was created to make tools that deliver brilliant audio quality. As the AV industry has grown and changed, so have we. Longtime fans of Symetrix, Mark and Rachelle Graham joined the Symetrix team in 2019 as owners, kicking off the next chapter in Symetrix’s 40+ year history. Their dream of working in an audio/video tech business with their family has become a delightful reality. Symetrix continues to enable inspirational AV experiences while serving our unique mission to be a force for good in the world.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft