#if !LINUX
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char **argv) {
char filename[] = "temp.dbc";
printf("\nSample program for the CANdb-API DLL:\n\n");
printf("1. Create a new data base with two messages and three signals...");
status = createNewDatabase(filename);
printf("\nError: Could not create a new database: %d\n", status);
return 0;
}
printf("done.\n\n");
printf("2. Display the contents of the database:\n");
status = dumpDatabase(filename);
printf("\nError: Could not dump the contents of the database: %d\n", status);
return 0;
}
printf("3. Remove the first message and change a signal in the second...");
status = editDatabase(filename);
printf("\nError: Could not edit a new database: %d\n", status);
return 0;
}
printf("done.\n\n");
printf("4. Display the contents of the edited database:\n");
status = dumpDatabase(filename);
printf("\nError: Could not dump the contents of the updated database: %d\n", status);
return 0;
}
printf("\nDone.\n");
return 0;
}
{
return "Intel";
return "Motorola";
} else {
return "Undefined";
}
}
{
return "Invalid";
return "Signed";
return "Unsigned";
return "Float";
return "Double";
} else {
return "Undefined";
}
}
unsigned char data[8];
int dlc = 8;
int t_raw = 0;
double t_phys = 0;
memset(data, 0, sizeof(data));
printf ("kvaDbOpen falied: %d\n", status);
return status;
}
printf ("kvaDbCreate failed: %d\n", status);
return status;
}
printf("kvaDbAddMsg failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgName failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgId failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgComment failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgDlc failed: %d\n", status);
return status;
}
printf("kvaDbAddSignal failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalName failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalComment failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalUnit failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalEncoding failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalRepresentationType failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueLimits failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueSize failed: %d\n", status);
return status;
}
printf("kvaDbAddMsg failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgName failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgId failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgComment failed: %d\n", status);
return status;
}
printf("kvaDbSetMsgDlc failed: %d\n", status);
return status;
}
printf("kvaDbAddSignal failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalName failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalComment failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalUnit failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalEncoding failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalRepresentationType failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueLimits failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueScaling failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueSize failed: %d\n", status);
return status;
}
printf("kvaDbAddSignal failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalName failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalComment failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalUnit failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalEncoding failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalRepresentationType failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueLimits failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueScaling failed: %d\n", status);
return status;
}
printf("kvaDbSetSignalValueSize failed: %d\n", status);
return status;
}
printf("kvaDbGetSignalByName failed: %d\n", status);
return status;
}
printf("kvaDbStoreSignalValuePhys failed: %d\n", status);
return status;
}
printf("kvaDbGetSignalValueFloat failed: %d\n", status);
return status;
}
printf("kvaDbGetSignalValueInteger failed: %d\n", status);
return status;
}
printf("kvaDbWriteFile failed: %d\n", status);
return status;
}
printf("kvaDbClose failed: %d\n", status);
return status;
}
return status;
}
{
unsigned int flags = 0;
printf("Could not create a database handle: %d\n", status);
return status;
}
printf("Could not load '%s': %d\n", filename, status);
return status;
}
printf ("kvaDbGetFlags failed: %d\n", status);
return status;
}
printf (" Database: flags=0x%x\n", flags);
printf ("kvaDbGetFirstMsg failed: %d\n", status);
return status;
}
char msg_name[100];
char msg_qname[200];
char msg_comment[200];
int dlc = 0;
unsigned int id = 0;
memset(msg_name, 0, sizeof(msg_name));
memset(msg_qname, 0, sizeof(msg_qname));
memset(msg_comment, 0, sizeof(msg_comment));
printf ("kvaDbGetMsgName failed: %d\n", status);
return status;
}
printf ("kvaDbGetMsgQualifiedName failed: %d\n", status);
return status;
}
printf ("kvaDbGetMsgComment failed: %d\n", status);
return status;
}
printf ("kvaDbGetMsgId failed: %d\n", status);
return status;
}
printf ("kvaDbGetMsgDlc failed: %d\n", status);
return status;
}
printf (" Msg: name='%s'\n", msg_name);
printf (" qname='%s', comment='%s'\n", msg_qname, msg_comment);
printf (" id=%x, dlc=%d, flags=%x\n", id, dlc, flags);
char signal_name[100];
char signal_qname[200];
char signal_comment[200];
char signal_unit[100];
int startbit = 0;
int length = 0;
double minval = 0;
double maxval = 0;
double factor = 0;
double offset = 0;
memset(signal_name, 0, sizeof(signal_name));
memset(signal_qname, 0, sizeof(signal_qname));
memset(signal_comment, 0, sizeof(signal_comment));
memset(signal_unit, 0, sizeof(signal_unit));
printf ("kvaDbGetSignalName failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalQualifiedName failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalComment failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalUnit failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalEncoding failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalRepresentationType failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalValueLimits failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalValueScaling failed: %d\n", status);
return status;
}
printf ("kvaDbGetSignalValueSize failed: %d\n", status);
return status;
}
printf(" Signal: name='%s', unit='%s'\n", signal_name, signal_unit);
printf(" qname='%s'\n", signal_qname);
printf(" comment='%s'\n", signal_comment);
printf(" encoding='%s'\n", sigEncToStr(sigEnc));
printf(" representation='%s'\n", sigRepToStr(sigType));
printf(" value min=%.02f, value max=%.02f\n", minval, maxval);
printf(" scale faktor=%.02f, offset=%.02f\n", factor, offset);
printf(" startbit=%d, length=%d\n", startbit, length);
}
}
printf ("kvaDbClose failed: %d\n", status);
return status;
}
printf("\n\n");
}
printf("kvaDbOpen falied: %d\n", status);
return status;
}
printf("Could not load '%s': %d\n", filename, status);
return status;
}
printf("Could not find the message with identifier '340':%d\n", status);
return status;
}
printf("Could not delete a signal: %d\n", status);
break;
}
}
printf("Could not delete the message with identifier '340':%d\n", status);
return status;
}
printf("Could not find the message with name 'TempMessage02':%d\n", status);
return status;
}
printf("Could not find the signal with name 'T01':%d\n", status);
return status;
}
printf("Could not change the scale factor for signal 'T01':%d\n", status);
return status;
}
printf("kvaDbWriteFile failed:%d\n", status);
return status;
}
printf("kvaDbClose falied:%d\n", status);
return status;
}
return status;
}