Page 1 of 1

Getting familiar with IBMDSwitcherSaveRecall Interface

PostPosted: Wed Sep 09, 2020 12:20 pm
by Jasmin
Hey everyone,

my goal is to create a "One-Button" solution to save the current status of a ATEM device. I found the IBMDSwitcherSaveRecall Interface and make it work in c# like so:

Code: Select all
static void Main(string[] args)
      {
         // Code out of the "SimpleSwitcherExampleCSharp" example of the SDK
         IBMDSwitcherDiscovery discovery = new CBMDSwitcherDiscovery();
         IBMDSwitcher switcher;
         _BMDSwitcherConnectToFailure failureReason;
         discovery.ConnectTo("10.30.1.183", out switcher, out failureReason);
         Console.WriteLine("Connected to switcher");
         var atem = new AtemSwitcher(switcher);

         // Here it happens
         IBMDSwitcherSaveRecall speicher = switcher as IBMDSwitcherSaveRecall;
              speicher.Save(_BMDSwitcherSaveRecallType.bmdSwitcherSaveRecallTypeStartupState);
         // Here it ends
         }



Now I am trying the whole thing in C++, having the (probably pretty naive) goal to make it work on a raspberry pi to eliminate the need to hook up a computer, just to save settings. The problem is, I cant figure out how to cast (like in the C# example) or somehow initialize the SwitcherSaveRecall variable, and without having this work, I dont know if the Save-method even work. Do someone have a functioning implementation to show?

This is my attempt so far:
Code: Select all
IBMDSwitcherSaveRecall* saver = ???;
saver->Save(bmdSwitcherSaveRecallTypeStartupState);


Thanks everyone
best wishes
J

Re: Getting familiar with IBMDSwitcherSaveRecall Interface

PostPosted: Wed Sep 09, 2020 6:10 pm
by Gary Adams
Hello Jasmin. There is a Developer Form here where you might find better help.

Regards, Gary

Re: Getting familiar with IBMDSwitcherSaveRecall Interface

PostPosted: Tue Oct 13, 2020 9:53 am
by Jasmin
Ah, thanks Gary, I reposted it there.

Re: Getting familiar with IBMDSwitcherSaveRecall Interface

PostPosted: Tue Oct 13, 2020 1:26 pm
by Tony Rivera
Moved post to the proper section of the forums.

Re: Getting familiar with IBMDSwitcherSaveRecall Interface

PostPosted: Thu Oct 15, 2020 12:31 am
by Cameron Nichols
Hi Jasmin,

Please be aware that the ATEM Switchers SDK is only supported on Windows and macOS platforms.

Where C# casts between interfaces, C++ equivalent will use QueryInterface.
Code: Select all
IBMDSwitcherSaveRecall* saver = nullptr;
HRESULT hr = switcher->QueryInterface(IID_IBMDSwitcherSaveRecall, (void**)&saver);
if (hr == S_OK)
    hr = saver->Save(bmdSwitcherSaveRecallTypeStartupState);

Regards
Cameron

Re: Getting familiar with IBMDSwitcherSaveRecall Interface

PostPosted: Wed Oct 28, 2020 9:00 am
by Ian Morrish
You can do this on the Raspberry Pi using either a Node.JS or .Net core library (neither use the official API).
I have a PowerShell Core Library which makes it easy to do on the Pi.
The following PS1 file can be run with pwsh.exe or in VSCode PowerShell console (on Mack, Linux or Windows)

Import-Module '.\netstandard2.0\ATEMModule.dll'
$AtemISO = Add-ATEMSwitch -IPAddress "192.168.1.126"
Set-ATEMStartupState $AtemISO

See https://1drv.ms/u/s!ApGpqMMpRLhik5E1tVgBIJ0eq5wx2A?e=GejKcl
You can then use the GPI pins from PowerShell with this module
Install-Module Microsoft.PowerShell.IoT

Then you can get the value of a pin with
Get-GpioPin 2