ACQ2XX_API
SoapTransport.cpp
Go to the documentation of this file.
00001 /* ------------------------------------------------------------------------- */
00002 /* file SoapTransport.cpp                                                    */
00003 /* ------------------------------------------------------------------------- */
00004 /*   Copyright (C) 2008 Peter Milne, D-TACQ Solutions Ltd
00005  *                      <Peter dot Milne at D hyphen TACQ dot com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of Version 2 of the GNU General Public License
00009     as published by the Free Software Foundation;
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
00019 /* ------------------------------------------------------------------------- */
00020 
00021 /** @file SoapTransport.cpp defines a Transport for SOAP service. STUB
00022  * ACQ2xx features a SOAP webservice that allows network control.
00023  * We already have an API "SOAPI" to use SOAP directly, this transport is
00024  * an adapter to match SOAPI to the generic API.
00025  */
00026 #include "local.h"
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include "acq_transport.h"
00031 #include "SoapTransport.h"
00032 
00033 
00034 
00035 class SoapTransport: public Transport {
00036 /** Transport implementation connects to locate linux Kernel Device Driver. */
00037 public:
00038         SoapTransport(const char* id):  Transport(id)
00039         {
00040                 fprintf(stderr, "SoapTransport WORKTODO");      
00041         }
00042 
00043         virtual STATUS acqcmd(
00044                 const char* command, char *response, int maxresponse)
00045         /**< send an "acqcmd" (acquisition command or query) to the card.
00046          * @param command - the command (or query) to send
00047          * @param response - user buffer to collect response.
00048          * @param maxresponse - maximum response size required.
00049          */
00050         {
00051                 return STATUS_WORKTODO;
00052         }
00053 
00054         virtual STATUS acq2sh(
00055                 const char* command, char *response, int maxresponse)
00056         /**< run a remote shell command or query. 
00057          * @param command - the command (or query) to send
00058          * @param response - user buffer to collect response.
00059          * @param maxresponse - maximum response size required.
00060          */
00061         {
00062                 return STATUS_WORKTODO;
00063         }
00064 
00065         virtual STATUS waitStateChange(
00066                 int timeout, char* response, int maxresponse)
00067         /**< block until remote state changes or timeout. */
00068         {
00069                 return STATUS_WORKTODO;
00070         }
00071 
00072         virtual STATUS readChannel(
00073                 int channel, short* data,
00074                 int nsamples, int start = 0, int stride = 1)
00075         /**< read and output raw data for channel
00076          * @param channel - channel number 1..N
00077          * @param data - caller's buffer
00078          * @param nsamples - max samples to read
00079          * @param start - start sample in data set
00080          * @param stride - stride [subsample] value
00081          * @returns actual samples returned or STATUS_ERR
00082          */
00083         {
00084                 return STATUS_WORKTODO;
00085         }
00086 };
00087 
00088 
00089 
00090 Transport* SoapTransportFactory::createTransport(const char* id)
00091 /**< SoapTransport factory method - create if id begins http:// . */
00092 {
00093         if (strstr(id, "http://") != 0){
00094                 return new SoapTransport(id);
00095         }else{
00096                 return 0;
00097         }
00098 }