INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

arcnetio.h

00001 /*************************************************************************
00002         
00003         date            : August 2008
00004         copyright       : (C) 2005 J.D. Yamokoski
00005         email   : yamokosk+gnu at gmail dot com
00006 
00007  This library is free software; you can redistribute it and/or
00008  modify it under the terms of the GNU Lesser General Public License as
00009  published by the Free Software Foundation; either version 2.1 of the License,
00010  or (at your option) any later version. The text of the GNU Lesser General
00011  Public License is included with this library in the file LICENSE.TXT.
00012  
00013  This library is distributed in the hope that it will be useful, but WITHOUT
00014  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015  or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE.TXT for
00016  more details.
00017  
00018  *************************************************************************/
00019 
00020 #ifndef HYDRO_MHI_ARCNET_IO_H
00021 #define HYDRO_MHI_ARCNET_IO_H
00022 
00023 // External
00024 #include <sys/types.h>
00025 #include <sys/socket.h>
00026 #include <string>
00027 
00028 // Internal
00029 #include "message.h"
00030 
00031 namespace mhipa10arc
00032 {
00033 
00034 class ArcnetIO
00035 {
00036 public:
00037         // Max number of seconds to wait for a response from the PA10
00038         const unsigned int ALARM_TIMEOUT;
00039         const unsigned int SELECT_TIMEOUT;
00040         
00041         ArcnetIO();
00042         ArcnetIO( const std::string& deviceName );
00043     ~ArcnetIO();
00044 
00045     // public interface
00046     void enable();
00047     void disable(void);
00048     MessagePtr readMessage();
00049     void writeMessage( const MessagePtr& msg );
00050 
00051     void setNonBlocking ( const bool );
00052 
00053 private:
00054         // Socket initialization
00055         void createSocket();
00056         void bindDevToSocket();
00057 
00058         // Data Transimission
00059         void send ( const uint8_t* msg, unsigned int length ) const;
00060         void recv ( uint8_t* msg );
00061 
00062         // STORAGE
00063         bool isEnabled_;
00064 
00065     // Socket information
00066         int socket_;
00067         std::string deviceName_;
00068         struct sockaddr sa_;
00069 };
00070 
00071 } // namespace
00072 
00073 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5