LANC CONTROL .net

The Lanc Control .net Component allows rapid development of Video Control user applications.  The .net Control can be added to Visual Studio's ToolBox and then dragged and dropped onto the user form just like any other control.  The Component implements all functionality for the Detection, Connection and Control and Receiving of Status and Timecode.

Download:
The latest version of the control v1.0.2.0 can be downloaded by clicking here.

Properties
:
  Name Description
Public property  DeviceID Sets the ID of the Device to open (this is the devices serial number)
Public property  NumOfDevices Gets the number of Devices currently attached to the PC.

Methods:
  Name Description
Public property  Close Closes the currently open device
Public property  EnumDeviceID Gets the device IDs of the currently attached devices.
Public property  SendLancCommand Sends a LANC Command (2 or 4 bytes message, with or without repeat count)
Public property  Open Opens the device specified by DeviceID for communictions

 Events:
  Name Description
Public property  LancData Contains the current video status and timecode, occurs on every video field.

Example Software

Opening a Device:
The deviceID specifies the serial number of the cable to be opened for communications.  The deviceID can either be "hard-cdoed" if the software will always use the same cable, or it may be got by using the EnumDeviceID method with an index of 0 - the first device).


Visual Basic


Private Sub ButtonOpen_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonOpen.Click

Dim myDeviceID As String = ""

If LancCtrl1.EnumDeviceID(0, myDeviceID) = True Then

LancCtrl1.DeviceID = myDeviceID

LancCtrl1.Open()

Else

MsgBox("no device connected")

End If

End Sub


C#


private void buttonOPEN_Click(object sender, EventArgs e)

{

string myDeviceID = "";

if (lancCtrl1.EnumDeviceID(0, ref myDeviceID) == true)

{

lancCtrl1.DeviceID = myDeviceID;

lancCtrl1.Open();

}

else

{

MessageBox.Show("no device connected");

}

}

Sending a Command:
The LancCommand method is used to send Lanc Commands, the method is overloaded with 3 versions to allow 2byte, 4byte and 4byte with a repeat count messages.  The following software is used to mimic what a 'fastforward' video button may do.  Whilst the button is down the video is continuously in fastforward (cue if in play mode) and when the button is released the ff/cue stops.

Visual Basic


Private Sub buttonFF_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles buttonFF.MouseDown

LancCtrl1.SendLancCommandVTR(LancCtrl.LancCommandVTR.FF, 0)

End Sub

Private Sub buttonFF_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles buttonFF.MouseUp

LancCtrl1.SendLancCommandVTR(LancCtrl.LancCommandVTR.FF)

End Sub


C#


private void buttonFF_MouseUp(object sender, MouseEventArgs e)

{

//FF (cancel the Continuous FF by sending a single FF command)

lancCtrl1.SendLancCommandVTR(LancCommandVTR.FF);

}

private void buttonREW_MouseDown(object sender, MouseEventArgs e)

{

//Continuous REW

lancCtrl1.SendLancCommandVTR(LancCommandVTR.REW, 0x00);

}


 

Receiving Data:
The LancData Event is called every video field (50Hz PAL/60Hz NTSC).  The user can extract the current video data whilst processing this event.  As the Event is called from a different Thread to the GUI (Graphical User Interface) the event should be Invoked if any GUI updates are to be done.  The following code displays the current timecode from the video device into a text box.


Visual Basic


Private Sub LancCtrl1_LancData(ByVal sender As Object, ByVal args As LancDataEventArgs) Handles LancCtrl1.LancData

If InvokeRequired = True Then

Try

Invoke(New LancDataEventHandler(AddressOf LancCtrl1_LancData), New Object() {sender, args})

Catch ex As Exception

Console.WriteLine(ex.ToString())

End Try

Else

TextBoxTimeCodeDisplay.Text = args.framedata.Hours.ToString("00") & ":" & args.framedata.Minutes.ToString("00") & ":" & args.framedata.Seconds.ToString("00") & "." + args.framedata.Frames.ToString("00")

TextBoxStatusDisplay.Text = args.framedata.Status.ToString()

End If

End Sub



C#


private void lancCtrl1_LancData(object sender, LancDataEventArgs args)

{

if (InvokeRequired)

{

try

{

Invoke(new LancDataEventHandler(lancCtrl1_LancData), new object[] { sender, args });

}

catch (Exception ex)

{

Console.WriteLine(ex.ToString());

}

}

else

{

textBoxTimeCodeDisplay.Text = args.framedata.Hours.ToString("00") + ":" + args.framedata.Minutes.ToString("00") + ":" + args.framedata.Seconds.ToString("00") + "." + args.framedata.Frames.ToString("00");

textBoxStatusDisplay.Text = args.framedata.Status.ToString();

}

}



Example Software:
Remote
Click here to download example software for both a C# and Visual Basic Implementation of a very simple Video Remote Control.  The software has a drop down list of the available video devices (which can be refreshed) which can then be opened for communication.  The display shows the Status and Time code.  The control buttons allow basic transport control but also include press and hold cue/review implementation.
amexmastercardvisajcbmaestrodiscoverpaypal
powered by stripe     PayPal Logo
Copyright © 2001-2018 AVIT Research ltd. Last modified: 02/11/19
ISO 9001:2015 Certified