examples/DS401_Slave_Gui/CallBack.cpp
author fojtik <>
Thu, 18 Oct 2012 17:44:33 +0200
changeset 758 9234361a4678
parent 407 384c3cd7afa2
permissions -rw-r--r--
Added comments
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"
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    29
extern "C"
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    30
{
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    31
#include "ObjDict.h"
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    32
}
246
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
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    35
extern wxTextCtrl *textLog;
246
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
/*****************************************************************************/
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    38
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    39
Call_heartbeatError (CO_Data * d, UNS8 heartbeatID)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    40
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    41
  //*textLog << wxT("HeartbeatError\n");
246
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
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    44
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    45
Call_initialisation (CO_Data * d)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    46
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    47
  //*textLog << wxT("Initialisation\n");
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    48
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    49
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    50
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    51
Call_preOperational (CO_Data * d)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    52
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    53
  //*textLog << wxT("PreOperational\n");
246
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
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    56
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    57
Call_operational (CO_Data * d)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    58
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    59
  //*textLog << wxT("Operational\n");
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    60
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    61
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    62
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    63
Call_stopped (CO_Data * d)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    64
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    65
  //*textLog << wxT("Stopped\n");
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    66
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    67
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    68
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    69
Call_post_sync (CO_Data * d)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    70
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    71
  //*textLog << wxT("Post_sync\n");
407
384c3cd7afa2 Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents: 382
diff changeset
    72
 /* printf ("POST SYNC:\n");
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    73
  printf
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    74
    ("     Write_Outputs: %x \n     Analogue_Output1: %d \n     Analogue_Output2: %d \n",
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    75
     Write_Outputs_8_Bit[0], Write_Analogue_Output_16_Bit[0],
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    76
     Write_Analogue_Output_16_Bit[1]);
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    77
  printf
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    78
    ("     Read_Input: %x \n     Analogue_Input1: %d \n     Analogue_Input2: %d \n",
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    79
     Read_Inputs_8_Bit[0], Read_Analogue_Input_16_Bit[0],
407
384c3cd7afa2 Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents: 382
diff changeset
    80
     Read_Analogue_Input_16_Bit[1]);*/
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    81
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    82
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    83
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    84
Call_post_TPDO (CO_Data * d)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    85
{
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    86
  //*textLog << wxT("Post_TPDO\n");
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    87
}
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    88
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    89
void
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    90
Call_storeODSubIndex (CO_Data * d, UNS16 wIndex, UNS8 bSubindex)
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    91
{
407
384c3cd7afa2 Fixed some win32 stdout related problems. May not worl wit visualstudio debug log anymore.
etisserant
parents: 382
diff changeset
    92
  /*printf ("StoreODSubIndex : %4.4x %2.2x\n", wIndex, bSubindex);*/
382
860e858685d3 Cleaned re-indented code of DS401_Slave_Gui
etisserant
parents: 378
diff changeset
    93
  //*textLog << wxT("StoreODSubIndex :\n");
246
d635cfc520ee Added contribution from Nicolas GRANDEMANGE. DS-401 slave GUI based on wxwidget.
etisserant
parents:
diff changeset
    94
}