examples/DS401_Slave_Gui/CallBack.cpp
author etisserant
Wed, 01 Aug 2007 13:48:03 +0200
changeset 246 d635cfc520ee
child 295 25ff2fadff89
permissions -rw-r--r--
Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     1
/*
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     3
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     5
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     7
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    12
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    17
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    21
*/
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    22
#include <wx/wxprec.h>
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    23
#include <wx/wx.h>
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    24
#include <wx/textctrl.h>
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    25
#include <iostream>
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    26
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    27
#include "CallBack.h"
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    28
#include "main.h"
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    29
extern "C" 
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    30
  {
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    31
	#include "ObjDict.h"
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    32
  }
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    33
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    34
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    35
extern wxTextCtrl 	*textLog;
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    36
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    37
/*****************************************************************************/
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    38
void Call_heartbeatError(UNS8 heartbeatID)
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    39
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    40
	*textLog << wxT("HeartbeatError\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    41
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    42
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    43
void Call_initialisation()
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    44
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    45
	*textLog << wxT("Initialisation\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    46
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    47
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    48
void Call_preOperational()
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    49
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    50
	*textLog << wxT("PreOperational\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    51
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    52
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    53
void Call_operational()
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    54
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    55
	*textLog << wxT("Operational\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    56
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    57
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    58
void Call_stopped()
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    59
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    60
	*textLog << wxT("Stopped\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    61
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    62
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    63
void Call_post_sync()
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    64
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    65
    *textLog << wxT("Post_sync\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    66
	printf("POST SYNC:\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    67
	printf("     Write_Outputs: %x \n     Analogue_Output1: %d \n     Analogue_Output2: %d \n", Write_Outputs_8_Bit[0], Write_Analogue_Output_16_Bit[0], Write_Analogue_Output_16_Bit[1]);
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    68
	printf("     Read_Input: %x \n     Analogue_Input1: %d \n     Analogue_Input2: %d \n", Read_Inputs_8_Bit[0], Read_Analogue_Input_16_Bit[0], Read_Analogue_Input_16_Bit[1]);
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    69
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    70
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    71
void Call_post_TPDO()
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    72
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    73
	*textLog << wxT("Post_TPDO\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    74
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    75
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    76
void Call_storeODSubIndex(UNS16 wIndex, UNS8 bSubindex)
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    77
{
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    78
	printf("StoreODSubIndex : %4.4x %2.2x\n", wIndex,  bSubindex);
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    79
	*textLog << wxT("StoreODSubIndex :\n");
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    80
}