CommAPI: Difference between revisions

From AutoIt Wiki
Jump to navigation Jump to search
m (Removed typo)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
CommAPI translates the communications functions of Windows API to AutoIt functions.
[[Category:CommAPI]]CommAPI translates the communications functions of Windows API to AutoIt functions.


== Overview ==
== Overview ==
Line 18: Line 18:
* [[CommUtilities.au3]]
* [[CommUtilities.au3]]
* [[CommInterface.au3]]
* [[CommInterface.au3]]
* [[CommObsolete.au3]] (only needed for backward compatibility)


=== Examples ===
=== Examples ===
[[CommAPI Examples]] shows you some examples. Mayby you could find more examples in [http://www.autoitscript.com/forum/topic/155674-commapi-serial-and-parallel-communication-with-windows-api/?p=1126366 forum].
[[CommAPI Examples]] shows you some examples. Maybe you could find more examples in [http://www.autoitscript.com/forum/topic/155674-commapi-serial-and-parallel-communication-with-windows-api/?p=1126366 forum].


== Background ==
== Background ==
Line 26: Line 27:
* 2008-09-12 Creation of cfx.au3 [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/#entry578111 (V1.0)]
* 2008-09-12 Creation of cfx.au3 [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/#entry578111 (V1.0)]
* 2011-02-18 Conversation of cfx.au3 into cfxUDF.au3 [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/page-2#entry872154 (V2.0)]
* 2011-02-18 Conversation of cfx.au3 into cfxUDF.au3 [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/page-2#entry872154 (V2.0)]
* 2011-02-28 Update V2.0to [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/page-2#entry874547 V2.1]
* 2011-02-28 Update V2.0 to [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/page-2#entry874547 V2.1]
* 2011-04-27 Update V2.1 to [http://www.autoit.de/index.php?page=Thread&postID=217993#post217993 V2.2] (german forum)
* 2011-04-27 Update V2.1 to [http://www.autoit.de/index.php?page=Thread&postID=217993#post217993 V2.2] (german forum)
* 2013-07-10 Modify V2.1 to [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/page-2#entry1094288 V2.1mod]
* 2013-07-10 Modify V2.1 to [http://www.autoitscript.com/forum/topic/80344-serial-communication-using-kernel32dll/page-2#entry1094288 V2.1mod]
Line 57: Line 58:
: replace _CommAPI_TransmitData with _CommAPI_TransmitBinary & _CommAPI_TransmitString
: replace _CommAPI_TransmitData with _CommAPI_TransmitBinary & _CommAPI_TransmitString
: Create CommObsolete.au3 for backward compatibility
: Create CommObsolete.au3 for backward compatibility
; 2014-04-08
: Fix error in _CommAPI_ReceiveBinary


=== Roadmap ===
=== Roadmap ===
Line 67: Line 70:
* [http://msdn.microsoft.com/en-us/library/aa363194(v=vs.85).aspx MSDN Library of communications functions]
* [http://msdn.microsoft.com/en-us/library/aa363194(v=vs.85).aspx MSDN Library of communications functions]
* [http://www.hpcc.ecs.soton.ac.uk/software/Win32API.Txt WIN32API.TXT]
* [http://www.hpcc.ecs.soton.ac.uk/software/Win32API.Txt WIN32API.TXT]
* cfxUDF.au3 (see section above)
* [[CommAPI#History|cfxUDF.au3]]
* [http://www.autoit.de/index.php?page=Thread&postID=198669#post198669 GetCOMPorts] (german forum)
* [http://www.autoit.de/index.php?page=Thread&postID=198669#post198669 GetCOMPorts] (german forum)
* [http://www.autoitscript.com/forum/topic/19713-problem-with-struct/#entry136466 ParseCommState]
* [http://www.autoitscript.com/forum/topic/19713-problem-with-struct/#entry136466 ParseCommState]
Line 125: Line 128:
* ReceiveBinary
* ReceiveBinary
* ReceiveString
* ReceiveString
* TransmitData
* TransmitBinary
* TransmitString

Latest revision as of 07:06, 4 May 2014

CommAPI translates the communications functions of Windows API to AutoIt functions.

Overview

Features

  • No need to install DLL's
  • Using Windows API calls (kernel32.dll)
  • Possibility of serial communication (serial port, COM port, RS-232)
  • Possibility of parallel communication (parallel port, LPT port)
  • No use of global variables
  • Uniform namespace _CommAPI_XXX
  • Modular organization into files
  • A lot of additional utility and helper functions

Scripts

Examples

CommAPI Examples shows you some examples. Maybe you could find more examples in forum.

Background

History

  • 2008-09-12 Creation of cfx.au3 (V1.0)
  • 2011-02-18 Conversation of cfx.au3 into cfxUDF.au3 (V2.0)
  • 2011-02-28 Update V2.0 to V2.1
  • 2011-04-27 Update V2.1 to V2.2 (german forum)
  • 2013-07-10 Modify V2.1 to V2.1mod
  • 2013-10-24 Creation of CommAPI.au3

Changelog

2014-01-23
Small update of method _CommAPI_CreateModeString
2014-02-03
Change timeout handling (Attention: not backward compatible)
Small update of method _CommAPI_PurgeComm
2014-03-07
Rename CommAPIStructures.au3 to CommAPIConstants.au3
Replace hex values with Constants
2014-03-27
Update of call _WinAPI_CreateFile
Updated @error handling
New parameter MaxLen for function _CommAPI_ReceiveData
New function _CommAPI_ReceiveLine
Update existing examples and add new examples
2014-03-31
Add constants
Fix _CommAPI_WaitCommEvent
2014-04-03
Fix reading error Chr(128) to Chr(255)
Fix error in _CommAPI_TransmitData
2014-04-04
Replace ReceiveData & ReceiveLine with ReceiveBinary & ReceiveString
2014-04-07
replace _CommAPI_TransmitData with _CommAPI_TransmitBinary & _CommAPI_TransmitString
Create CommObsolete.au3 for backward compatibility
2014-04-08
Fix error in _CommAPI_ReceiveBinary

Roadmap

There is no roadmap in the moment. Feel free to implement the last five remaining API calls, enhance the scripts or to fix bugs.

Support

There is no official support. Try to get help from community in the official forum. Here you can find the main thread.

Resources

Functions

Implemented API functions

  • BuildCommDCB
  • BuildCommDCBAndTimeouts
  • ClearCommBreak
  • ClearCommError
  • EscapeCommFunction
  • GetCommMask
  • GetCommModemStatus
  • GetCommProperties
  • GetCommState
  • GetCommTimeouts
  • PurgeComm
  • SetCommBreak
  • SetCommMask
  • SetCommState
  • SetCommTimeouts
  • SetupComm
  • TransmitCommChar
  • WaitCommEvent

Unimplemented API functions

  • CommConfigDialog
  • GetCommConfig
  • GetDefaultCommConfig
  • SetCommConfig
  • SetDefaultCommConfig

API helper functions

  • ChangeCommStateElement
  • ChangeCommTimeoutsElement
  • GetCommStateElement
  • GetCommTimeoutsElement
  • IsOnCTS
  • IsOnDCD
  • IsOnDSR
  • IsOnRI
  • SetCommStateElement
  • SetCommTimeoutsElement
  • SetOnDTR
  • SetOnRTS

Utility functions

  • CommStateToString
  • CommTimeoutsToString
  • CreateModeString
  • GetCOMPorts

Interface functions

  • ClosePort
  • OpenCOMPort
  • OpenPort
  • ReceiveBinary
  • ReceiveString
  • TransmitBinary
  • TransmitString