/usr/share/dx/samples/dxlink/maptoplane.c is in dxsamples 4.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #include <stdio.h>
#include "dxl.h"
#ifndef BASE
#define BASE "/usr/lpp/dx"
#endif
void SyncAfterExecute(DXLConnection *conn)
{
int status=1;
while (status) {
sleep(1);
if (DXLIsMessagePending(conn))
DXLHandlePendingMessages(conn);
DXLGetExecutionStatus(conn, &status);
}
}
/*
* this routine simply prints the maximum value as received from the
* DXLOutput tool
*/
void max_handler(DXLConnection *conn, const char *name, const char *value,
void *data)
{
printf("max value = %s\n", value);
}
main(int argc, char *argv[])
{
DXLConnection *conn = NULL;
char result[100];
int status;
/*
* Start Data explorer user interface in -edit mode, with certain
* in -edit mode, with certain menus turned off.
*/
conn = DXLStartDX("dx -edit -noExitOptions -noExecuteMenus -noConnectionMenus",NULL);
if (conn == NULL)
{
fprintf(stderr,"Could not connect\n");
perror("DXLStartDX");
exit(1);
}
/*
* Set the handler for the DXLOutput tool which is labelled
* "maptoplane_max"
*/
DXLSetValueHandler(conn, "maptoplane_max", max_handler, NULL);
/*
* Load the visual program to run. Set the value of the DXLInput
* tool which is labelled "file_to_import".
* Also set the value of the DXLInput tool which is labelled
* "maptoplane_point".
*/
DXLLoadVisualProgram(conn, BASE"/samples/dxlink/maptoplane.net");
DXLSetString(conn, "file_to_import","temperature");
DXLSetValue(conn, "maptoplane_point", "[0 5000 5000]");
/*
* Execute the visual program and check for input from maptoplane_max.
*/
DXLExecuteOnce(conn);
SyncAfterExecute(conn);
/* Change the value for the DXLInput tool labelled "maptoplane_point
* and execute again.
*/
DXLSetValue(conn, "maptoplane_point", "[10000 5000 5000]");
DXLExecuteOnce(conn);
SyncAfterExecute(conn);
/* Change the value for the DXLInput tool labelled "maptoplane_point
* and execute again.
*/
DXLSetValue(conn, "maptoplane_point", "[20000 5000 5000]");
DXLExecuteOnce(conn);
SyncAfterExecute(conn);
/* Change the value for the DXLInput tool labelled "maptoplane_point
* and execute again.
*/
DXLSetValue(conn, "maptoplane_point", "[30000 5000 5000]");
DXLExecuteOnce(conn);
SyncAfterExecute(conn);
/* Change the value for the DXLInput tool labelled "maptoplane_point
* and execute again.
*/
DXLSetValue(conn, "maptoplane_point", "[50000 5000 5000]");
DXLExecuteOnce(conn);
SyncAfterExecute(conn);
printf("Hit return to quit:");
gets(result);
DXLExitDX(conn);
}
|