Difference between revisions of "SimpleMotion V2 API documentation"
From Granite Devices Knowledge Wiki
[checked revision] | [checked revision] |
(→Functions) |
|||
Line 26: | Line 26: | ||
{{APIdoc|smuint32 smGetVersion()|Return SM lib version number in hexadecimal format. | {{APIdoc|smuint32 smGetVersion()|Return SM lib version number in hexadecimal format. | ||
Ie V 2.5.1 would be 0x020501 and 1.2.33 0x010233}} | Ie V 2.5.1 would be 0x020501 and 1.2.33 0x010233}} | ||
+ | |||
+ | {{APIdoc|smbus smOpenBus( const char * devicename )|Open SM RS485 communication bus.}} | ||
+ | ;devicename: | ||
+ | :"USB2VSD" or com port as "COMx" where x=1-n, i.e. COM15 | ||
+ | ;return value | ||
+ | :handle to be used with all other commands, -1 if fails | ||
+ | |||
+ | {{APIdoc|SM_STATUS smCloseBus( const smbus bushandle )|Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening.}} | ||
+ | ;return value | ||
+ | :a SM_STATUS value, i.e. SM_OK if command succeed. The SM_STATUS return value from all other functions have similar meaning. |
Revision as of 14:34, 26 March 2014
This page lists files and the API calls of SimpleMotion V2 C-library.
Contents
Files
- simplemotion.h
- The header file that declares API functions and constants used in SMV2 programs. Include this file in the C-file where SMV2 is used.
- simplemotion.dll or smv.dll
- A Win32 dynamic library. Place this file in application .exe folder if program is linked against the DLL. If project is being compiled with GNU GCC, then all library .c files may be added in the project to compile library statically in the program thus eliminate the need of .dll.
- simplemotion.lib or smv.lib
- A library file needed by some Microsoft C/C++ development tools to allow usage of DLL file. Most of other tools don't need these.
Types
SMV2 library uses custom integer types in order to have explicitly defined bit lengths. All types translate to standard C-types.
typedef long smbus; typedef unsigned long smuint32; typedef unsigned short smuint16; typedef unsigned char smuint8; typedef long smint32; typedef short smint16; typedef char smint8; typedef char smbool; #define smtrue 1 #define smfalse 0 typedef int SM_STATUS; typedef smuint8 smaddr;
Functions
smuint32 smGetVersion() Return SM lib version number in hexadecimal format.
Ie V 2.5.1 would be 0x020501 and 1.2.33 0x010233
{{{3}}} ====Return SM lib version number in hexadecimal format. Ie V 2.5.1 would be 0x020501 and 1.2.33 0x010233====smbus smOpenBus( const char * devicename ) Open SM RS485 communication bus.{{{3}}}
Open SM RS485 communication bus.
- devicename
- "USB2VSD" or com port as "COMx" where x=1-n, i.e. COM15
- return value
- handle to be used with all other commands, -1 if fails
SM_STATUS smCloseBus( const smbus bushandle ) Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening.{{{3}}}
Close connection to given bus handle number. This frees communication link therefore makes it available for other apps for opening.
- return value
- a SM_STATUS value, i.e. SM_OK if command succeed. The SM_STATUS return value from all other functions have similar meaning.