65 #define MAXSTRLEN 1024 67 #define FLTR_APP_DESC "Filetransfer application" 68 #define FLTR_CONTEXT_DESC "Filetransfer context" 70 #define FLTR_APP "FLTR" 71 #define FLTR_CONTEXT "FLTR" 88 printf(
"Usage: dlt-example-filetransfer [options] absolute-path-to-file\n");
89 printf(
"Simple filetransfer example");
90 printf(
"%s \n", version);
92 printf(
"-a apid - Set application id to apid (default: FLTR)\n");
93 printf(
"-c ctid - Set context id to ctid (default: FLTR)\n");
94 printf(
"-t ms - Timeout between file packages in ms (minimum 1 ms)\n");
95 printf(
"-d - Flag to delete the file after the transfer (default: false)\n");
96 printf(
"-i - Flag to log file infos to DLT before transfer file (default: false)\n");
97 printf(
"-h - This help\n");
103 int main(
int argc,
char* argv[])
121 while ((opt = getopt(argc, argv,
"idf:t:a:c:h")) != -1)
157 if (optopt ==
'a' || optopt ==
'c' || optopt ==
't')
159 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
161 else if (isprint (optopt))
163 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
167 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
176 for (index = optind; index < argc; index++)
184 fprintf(stderr,
"ERROR: No absolute path to file specified\n");
192 timeout = atoi(tvalue);
213 printf(
"File couldn't be transferred. Please check the dlt log messages.\n");
DLT_DECLARE_CONTEXT(fileContext)
Declare some context for the file transfer. It's not a must have to do this, but later you can set a ...
int main(int argc, char *argv[])
Main program dlt-test-filestransfer starts here.
int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, int timeout)
Transfer the complete file as several dlt logs.
#define DLT_UNREGISTER_APP()
void dlt_set_id(char *id, const char *text)
#define DLT_REGISTER_APP(APPID, DESCRIPTION)
#define DLT_REGISTER_CONTEXT(CONTEXT, CONTEXTID, DESCRIPTION)
#define DLT_UNREGISTER_CONTEXT(CONTEXT)
int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename)
Logs specific file inforamtions to dlt.
void dlt_get_version(char *buf, size_t size)
#define FLTR_CONTEXT_DESC