NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
Animation.h
1/************************************************************************************
2* Copyright (C) 2023 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* This source code is licensed per the NetSim license agreement. *
12* *
13* No portion of this source code may be used as the basis for a derivative work, *
14* or used, for any purpose other than its intended use per the NetSim license *
15* agreement. *
16* *
17* This source code and the algorithms contained within it are confidential trade *
18* secrets of TETCOS and may not be used as the basis for any other software, *
19* hardware, product or service. *
20* *
21* Author: Shashi Kant Suman *
22* *
23* ----------------------------------------------------------------------------------*/
24
25/* ,~~. *
26 * ( 6 )-_, *
27 * (\___ )=='-'
28 * \ . ) )
29 * \ `-' /
30 * ~'`~'`~'`~'`~
31 *
32 * *
33 * ---------------------------------------------------------------------------------*/
34#pragma once
35#ifndef _NETSIM_ANIMATION_H_
36#define _NETSIM_ANIMATION_H_
37#ifdef __cplusplus
38extern "C" {
39#endif
40#ifndef _NETSIM_ANIMATION_CODE_
41#pragma comment (lib,"Animation.lib")
42#endif
43
44#ifndef NETSIM_ID
45 typedef unsigned int NETSIM_ID;
46#endif
47
48#ifndef MAX_PACKET_TYPE_LEN
49#define MAX_PACKET_TYPE_LEN 100
50#endif
51
52 typedef void* ANIM_HANDLE;
53
54 typedef enum enum_anim_flag
55 {
56 ANIMFLAG_DISABLE,
57 ANIMFLAG_OFFLINE,
58 ANIMFLAG_ONLINE,
59 }ANIM_FLAG;
60
61 typedef enum enum_anim_fileType
62 {
63 ANIMFILETYPE_GENERIC,
64 ANIMFILETYPE_TABLE,
65 ANIMFILETYPE_2DPLOT,
66 ANIMFILETYPE_3DPLOT,
67 ANIMFILETYPE_GRAPH,
68 ANIMFILETYPE_BATTERY,
69 }ANIMFILETYPE;
70 static char animFileType[][50] = { "generic","table","2dplot","3dplot","graph","battery" };
71
72 typedef enum enum_anim_type
73 {
74 ANIM_EXIT,
75 ANIM_MOVENODE,
76 ANIM_NODEJOIN,
77 ANIM_NODELEAVE,
78 ANIM_TRANSMITPACKET,
79 ANIM_LABEL,
80 ANIM_LINE,
81 ANIM_CIRCLE,
82 ANIM_REACTANGLE,
83 ANIM_GRAPH,
84 ANIM_PLOT2D,
85 ANIM_PLOT3D,
86 ANIM_TABLE,
87 ANIM_BATTERY,
88 ANIM_CUSTOM,
89 }ANIM_TYPE;
90 static char animType[][50] = { "EXIT",
91 "MOVENODE",
92 "NODEJOIN",
93 "NODELEAVE",
94 "TRANSMITPACKET",
95 "LABEL",
96 "LINE",
97 "CIRCLE",
98 "REACTANGLE",
99 "GRAPH",
100 "PLOT2D",
101 "PLOT3D",
102 "TABLE",
103 "BATTERY",
104 "" };
105
106 typedef struct stru_move_node
107 {
108 NETSIM_ID d;
109 double time;
110 double x;
111 double y;
112 double z;
113 }MOVENODE,*ptrMOVENODE;
114
115 typedef struct stru_transmit_packet
116 {
117 NETSIM_ID tx;
118 NETSIM_ID rx;
119 double startTime;
120 double endTime;
121 char name[MAX_PACKET_TYPE_LEN];
122 int type;
123 }TRANSMITPACKET, *ptrTRANSMITPACKET;
124
125 typedef struct stru_line
126 {
127 double time;
128 double x1;
129 double y1;
130 double x2;
131 double y2;
132 }LINE, *ptrLINE;
133
134 //Animation flag
135 _declspec(dllexport) ANIM_FLAG anim_get_anim_flag();
136 _declspec(dllexport) void anim_set_anim_flag(char* flag);
137
138 //Animation menu
139 /* handle: if not null, then new menu will be sub menu of handle.
140 * name: name of the menu.
141 * isThreadReq: if true, animation engine will create new thread.
142 * isNewScreen: if true, GUI animator will open in new window
143 * isFile: is true, animation engine will create default file to write
144 * maxDatalen: expected max len for char written in file for each entry, default BUFSIZ
145 * filetype: Type of file, Gui animator engine will call jar based on this
146 */
147 _declspec(dllexport) ANIM_HANDLE anim_add_new_menu(ANIM_HANDLE handle,
148 char* name,
149 bool isThreadReq,
150 bool isNewScreen,
151 bool isFile,
152 UINT maxDataLen,
153 ANIMFILETYPE fileType);
154
155 //Animation API
156 _declspec(dllexport) void fn_NetSim_Anim_Init(char* ioPath);
157 _declspec(dllexport) void fn_NetSim_Anim_Close();
158
159 //Animation Table
160 _declspec(dllexport) void animation_table_new(ANIM_HANDLE animHandle,
161 char* heading);
162 _declspec(dllexport) void animation_table_time(ANIM_HANDLE animHandle,
163 double time);
164 _declspec(dllexport) void animation_table_row(ANIM_HANDLE animHandle,
165 char* format, ...);
166
167 //Add new animation entry
168 _declspec(dllexport) void animation_add_new_entry(ANIM_HANDLE animHandle,
169 ANIM_TYPE type,
170 void* format,
171 ...);
172
173 //Change the default file name. Animation won't write anything
174 _declspec(dllexport) void anim_set_file_name(ANIM_HANDLE handle, char* name);
175
176#ifdef __cplusplus
177}
178#endif
179#endif