OpcUaCanOpen
CANopen OPC-UA server
shutdown.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** shutdown.h
3 **
4 ** Copyright (c) 2006-2016 Unified Automation GmbH. All rights reserved.
5 **
6 ** Software License Agreement ("SLA") Version 2.5
7 **
8 ** Unless explicitly acquired and licensed from Licensor under another
9 ** license, the contents of this file are subject to the Software License
10 ** Agreement ("SLA") Version 2.5, or subsequent versions
11 ** as allowed by the SLA, and You may not copy or use this file in either
12 ** source code or executable form, except in compliance with the terms and
13 ** conditions of the SLA.
14 **
15 ** All software distributed under the SLA is provided strictly on an
16 ** "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
17 ** AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
18 ** LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 ** PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the SLA for specific
20 ** language governing rights and limitations under the SLA.
21 **
22 ** The complete license agreement can be found here:
23 ** http://unifiedautomation.com/License/SLA/2.5/
24 **
25 ** Project: C++ OPC Server SDK sample code
26 **
27 ** Description: Portable shutdown flag using CTRL-C (SIGINT)
28 ** Notes: Visual Studio catches CTRL-C when it's thrown by default,
29 ** which is not wanted normally. You can disable this by opening the
30 ** exceptions dialog via the menu Debug->Exceptions. Then deactivate
31 ** the "CTRL-C" exception in the "Win32 Exceptions" category.
32 **
33 ******************************************************************************/
34 #ifndef __SHUTDOWN_H__
35 #define __SHUTDOWN_H__
36 
37 #ifdef _WIN32
38 # ifdef _WIN32_WCE
39 /* Windows CE */
40 # define SHUTDOWN_SEQUENCE "Escape"
41 # else /* _WIN32_WCE */
42 /* Windows 2000/XP/Vista */
43 /* Uncomment the following line to use CTRL-C on Windows to shutdown. */
44 //#define USE_CTRLC_ON_WINDOWS
45 # ifdef USE_CTRLC_ON_WINDOWS
46 /* Use CTRL-C signal */
47 # define SHUTDOWN_SEQUENCE "CTRL-C"
48 # else /* USE_CTRLC_ON_WINDOWS */
49 /* Use 'x' to shutdown using DOS conio.h */
50 # define SHUTDOWN_SEQUENCE "x"
51 # endif /* USE_CTRLC_ON_WINDOWS */
52 # endif /* _WIN32_WCE */
53 #else /* _WIN32 */
54 /* Linux */
55 # define SHUTDOWN_SEQUENCE "CTRL-C"
56 #endif /* _WIN32 */
57 
58 /* activate some logging */
59 #define SHUTDOWN_TRACE_ACTIVE
60 #ifdef SHUTDOWN_TRACE_ACTIVE
61 # include <stdio.h> /* for printf */
62 # define SHUTDOWN_TRACE printf
63 #else
64 # define SHUTDOWN_TRACE
65 #endif
66 
67 /* Call this on startup. */
69 
70 /* Use this to check if the shutdown flag is set. */
71 unsigned int ShutDownFlag();
72 
73 /* Use this to get the application path created with new. Delete returned char array if not NULL. */
74 char* getAppPath();
75 
76 #endif