Click or drag to resize

KM_Controller Class

This is the primary object for interfacing with a Dynomotion product in code You can think of this object as representing the board and an access point for features of the hardware There should only be one KM_Controller object per board, per application domain at any given time To set project to update the GAC: "$(FrameworkSdkDir)\bin\gacutil.exe" /i "$(TargetPath)" /f
Inheritance Hierarchy
SystemObject
  KMotion_dotNetKM_Controller

Namespace: KMotion_dotNet
Assembly: KMotion_dotNet (in KMotion_dotNet.dll) Version: 1.0.1.0 (1.0.1.0)
Syntax
public class KM_Controller : IDisposable

The KM_Controller type exposes the following members.

Constructors
 NameDescription
Public methodKM_Controller(Boolean) Default constructor for the KM_Controller object Use this for single board applications
Public methodKM_Controller(Int32, Boolean) Multiple board constructor for attaching this object to a specific board address
Top
Properties
 NameDescription
Public propertyBoardID Board USB ID
Public propertyBoardNumber Board number (for use in multiple board scenarios)
Public propertyBoardType Dynomotion board device type
Public propertyCoordMotion Coordinated Motion Component
Public propertyCurrentStatus Locally maintained Main_Status struct
Public propertyErrorLog Contains all error messages until cleared
Public propertyInstanceHandle KMotion_DLL class instance pointer
Public propertyLoaded Flag to determine that this object has been properly initialized
Public propertyLockStatusOnUpdate Flags whether to obtain a lock token while gathering the status data
Public propertyMaxErrorLength Maximum allowed return error string length
Public propertyMessageLog Contains all messages until cleared
Public propertyStatusUpdateInterval Maximum time in ms between refreshing the status
Public propertyThrowExceptions If this flag is true, exceptions will be generated from the ErrorMsg handler
Top
Methods
 NameDescription
Public methodCheckCoffSize Determines and returns the section sizes of various sections in a KFLOP coff (common object file format) file
Public methodCheckConnected Tries to obtain a lock, and if a lock is obtained can execute optional actions before releasing the lock token.
Public methodCheckIsReady Call this to check if a "Ready" response came back after a command was manually typed in and we don't know what the response will be if any Note:There is a possibility that other DSP threads are printing to the console screen First check if any input is available if not, return instantly (KMOTION_OK) if so, then a whole line might not be available but should be in transmission and be in very soon, so wait up to a short while to get in an entire line if the line doesn't come in for some reason return (KMOTION_TIMEOUT) check if the line should go to the console (esc) if so print it and repeat the above as long as there is still input available if the line is not console data, check for "Ready", if it is "Ready" send it to the console and return KMOTION_READY; otherwise send it to the console ///
Public methodClearError Clears the Error log
Public methodClearFeedhold Clears Feedhold without Resuming(Performs Console Command StopImmediate2)
Public methodClearMessages Clears the Message log
Public methodCompile Compiles a source file
Public methodCompileAndLoadCoff Compiles a source file and loads it into the board
Public methodDisconnect Disconnect the application from the board
Public methodDispose Releases object resources
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodExecuteProgram(Int32) Executes a previously loaded program
Public methodExecuteProgram(Int32, String, Boolean) Loads and executes a program from file
Public methodFeedhold Initiates Feedhold (Performs Console Command StopImmediate0)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetAxis Creates a KM_Axis object
Public methodGetAxisGroup Creates a KM_AxisGroup
Public methodGetBoards Get Boards checks the list of connected board locations and returns the total board count
Public methodGetBoardType Gets the board type BOARD_TYPE.KFLOP = 2 = KFlop 8 Axes Controller BOARD_TYPE.KOGNA = 3 = Kogna 16 Axis Controller
Public methodGetCommandValueT Returns the value of a WriteLineReadLine(), converted to the requested type
Public methodGetFirmwareVersion Query device for the loaded firmware version
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetIO Creates a new KM_IO bit
Public methodGetStatus Generates and returns an updated copy of the MAIN_STATUS structure
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetUSBLocation USB tree node location
Public methodGetUserData Gets a 32 bit word of user data To set int value in KFLOP in C do: persist.UserData[index] = i;
Public methodGetUserDataDouble Gets a 64 bit double from a KFLOP user data pair of 32 bit vars To set double value in KFLOP in C do: *(double *)&persist.UserData[index*2] = d;
Public methodGetUserDataFloat Gets a 32 bit float word of user data To set float value in KFLOP in C do: *(float *)&persist.UserData[index] = f;
Public methodHasErrors Checks if any error messages are in qeue
Public methodHasMessages Checks if any messages are in qeue
Public methodKillProgramThreads Halts the execution of each supplied thread
Public methodKMotionLock Prevents outside access to the board This function is similar to the WaitToken function, except that it returns immediately (instead of waiting) if the board is already locked
Public methodLoadCoff(Int32, String) Load a compiled C program into the board
Public methodLoadCoff(Int32, String, Int32) Load a compiled C program into the board (with PackToFlash arg)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodReadLineTimeout Block the calling thread while waiting for the response to complete within a specified timeout
Public methodRecoverKMotionLock Recovers controller from a motion lock state
Public methodReleaseToken Allow normal access to the board
Public methodResetUserData Sets all words of user data to 0
Public methodResumeFeedhold Resumes Feedhold (Performs Console Command StopImmediate1)
Public methodServiceConsole Flushes the console buffer
Public methodSetCallbackHandler Sets the internal c++ interop callback handler Separate delegate for this callback prevents the Garbage Collector from releasing the unmanaged function pointer from being destroyed
Public methodSetFailed Places the controller in a failed state, prevents further commands from processing
Public methodSetUserData Sets a 32 bit word of integer user data
Public methodSetUserDataDouble Sets a pair of two 32 bit words with a 64-bit double of user data To get the value in KFLOP in C do: double f = *(double *)&persist.UserData[index*2];
Public methodSetUserDataFloat Sets a 32 bit word with a 32-bit float of user data To get the value in KFLOP in C do: float f = *(float *)&persist.UserData[index];
Public methodThreadExecuting Checks whether a User Program Thread is currently executing.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodWaitForThreadComplete Waits for a User Program Thread to finish executing.
Public methodWaitToken Prevents outside access to the board until ReleaseToken is commanded
Public methodWriteLine Sends a console command to the board
Public methodWriteLineReadLine Sends a console command to the board and waits for the return value
Public methodWriteLineWithEcho Sends a console command to the board while echoing commands back to the callback handler
Top
Events
 NameDescription
Public eventErrorReceived Error Messages are routed through this event
Public eventMessageReceived All general messages are pumped out from the internal callback handler thru this event
Top
See Also