source: trunk/Simulator/ModBusKit.h @ 6

Last change on this file since 6 was 6, checked in by mansoux, 14 years ago

Ajout client base MacOSX

File size: 3.2 KB
Line 
1//
2//  ModBusKit.h
3//  ModBusKit
4//
5//  Created by Matthew Butch on 03/02/08.
6//  Copyright 2008 Volitans Software and R Engineering, Inc.
7/*
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12 
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
21 
22 These library of functions are designed to enable a program send and
23 receive data from a device that communicates using the Modbus protocol.
24 */
25//
26//  This is an Objective-C interface to libmodbus
27
28#import <Cocoa/Cocoa.h>
29#include <IOKit/IOKitLib.h>
30#include <IOKit/serial/IOSerialKeys.h>
31#include <IOKit/IOBSD.h>
32
33#import "libmodbusWrapper.h"
34
35@interface ModBusKit : NSObject
36{
37        libmodbusWrapper *lmbWrap;
38       
39        int compatibilityVersionNumber;
40        NSString *modbuskitVersionString;
41        NSString *libmodbusVersionString;
42        NSString *address;
43        BOOL outputDebugMessages;
44}
45
46- (void) initialize;
47- (id) init;
48- (id) initWithSerialPort: (NSString *)serialLocation baudRate: (int) baudRate parity: (int) parity dataBits: (int) dataBits stopBits: (int) stopBits;
49- (id) initWithTCP: (NSString *)ipAddress port: (int)port;
50- (int) compatibilityVersion;
51- (NSString *) modbuskitVersion;
52- (NSString *) libmodbusVersion;
53- (BOOL) setupSerialPort: (NSString *)serialLocation baudRate: (int) baudRate parity: (int) parity dataBits: (int) dataBits stopBits: (int) stopBits;
54- (BOOL)setupTCP: (NSString *)ipAddress port: (int)port;
55- (int) openConnection;
56- (void) closeConnection;
57- (NSArray *) readDiscreteInput: (int) slaveID startAddress: (int) startAddress inputCount: (int) inputCount;
58- (NSArray *) readCoil: (int) slaveID startAddress: (int) startAddress coilCount: (int) coilCount;
59- (BOOL) writeSingleCoil: (int) slaveID coilAddress: (int) coilAddress state: (BOOL) state;
60- (BOOL) writeMultipleCoils: (int) slaveID startAddress: (int) startAddress coilCount: (int) coilCount stateData: (NSArray *) stateData;
61- (NSArray *) readInputRegisters: (int) slaveID startAddress: (int) startAddress registerCount: (int) registerCount;
62- (NSArray *) readHoldingRegisters: (int) slaveID startAddress: (int) startAddress registerCount: (int) registerCount;
63- (BOOL) writeSingleHoldingRegister: (int) slaveID registerAddress: (int) registerAddress value: (uint16_t) value;
64- (BOOL) writeMultipleHoldingRegisters: (int) slaveID startAddress: (int) startAddress registerCount: (int) registerCount valueData: (NSArray *) valueData;
65- (int) getLastError;
66- (NSString *) getLastErrorString;
67- (NSString *) getAddress;
68- (void) setDebug: (BOOL)debugToggle;
69- (BOOL) getDebug;
70- (void) setSaveRawData: (BOOL)toggle;
71- (NSArray *) getLastRawQuery;
72- (NSArray *) getLastRawResponse;
73
74+ (NSArray *)scanSerialPorts;
75+ (NSString *)getNextSerialPort:(io_iterator_t)serialPortIterator;
76
77
78@end
Note: See TracBrowser for help on using the repository browser.