Difference between revisions of "KMAPI"

From SoftMC-Wiki
Jump to: navigation, search
m (General Information)
(Initialization: initialization)
Line 21: Line 21:
  
 
==Initialization==
 
==Initialization==
 +
 +
The first step in using the KMAPI is to call the initialization function '''KMInitialize'''. <br>
 +
This ensures that the information which the KMAPI maintains internally about your application is correct.<br>
 +
No other KMAPI calls should be made before the KMAPI is initialized.
 +
 
==Error Messages==
 
==Error Messages==
 
==Sending/Retrieving Files==
 
==Sending/Retrieving Files==

Revision as of 07:47, 29 May 2017

Overview

The KMAPI software package allows you to communicate with softMC from popular programming languages, such as Visual Basic over TCP/IP and UDP. The KMAPI provides complete access to the command line interface of your system across a TCP/IP connection. Fast access to frequently changing data, such as axis set-points and feedback, is provided via a UDP connection, also called UDP fast data.

Introduction

The KMAPI addresses several concerns when interfacing your program with Kollmorgen drives and controllers, including:

  • sending commands (and receiving responses)
  • reading and setting amplifier or controller variables
  • sending and retrieving files
  • error handling

The KMAPI addresses these concerns by providing a library of functions which allow the user to describe their system in terms of devices (amplifiers, controllers, axes, groups) and then communicate with these devices individually.
Central to the KMAPI is the concept of a device table. The device table is a data store (database) which is managed by the KMAPI for the user.
The device table is populated with devices by the programmer, allowing the programmer to execute commands on any device in the device table. Most details of the communication techniques used are hidden allowing the programmer to focus on high level programming instead of communication protocols.

General Information

The KMAPI is available for Windows NT and is compatible with a wide variety of 32-bit programming tools including Microsoft Visual Basic and Microsoft Visual C++.
The KMAPI is provided as a Windows DLL which makes it accessible from most Windows programming languages.
Most KMAPI functions return an error code which indicates the success of the action requested by the programmer. Full text descriptions of the error are often associated with the error and can be accessed via KMAPI calls.

Initialization

The first step in using the KMAPI is to call the initialization function KMInitialize.
This ensures that the information which the KMAPI maintains internally about your application is correct.
No other KMAPI calls should be made before the KMAPI is initialized.

Error Messages

Sending/Retrieving Files

Advanced asynchronous message handling

Asynchronous messages and Microsoft Visual Basic

Library Reference

KMInitialize

KMTerminate

KMCreateController

KMExecuteCmd

KMExecuteCmdResponse

Example #1

KMGetFile

KMPutFile

Error Handling

Error Codes

KMErrorGetMessage

KMErrorGetDeviceMessage

KMErrorGetOriginalDeviceMessage

Example #3