#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/time.h>

#ifndef omcLib__H
#define omcLib__H

#ifndef _T_BOOL
#define _T_BOOL
typedef unsigned char BOOL;
#endif

#ifndef _T_BYTE
#define _T_BYTE
typedef unsigned char BYTE;
#endif

#ifndef _T_WORD
#define _T_WORD
typedef unsigned short WORD;
#endif

#ifndef _T_DWORD
#define _T_DWORD
typedef unsigned int DWORD;
#endif


// define struct for dual
#define MAX_SYNC_FILE_INDEX 1000000
typedef struct _sync_source
{
	char name[128];
	char senddir[256];
	unsigned int syncfilesize;
	unsigned int syncfileindex;
	char curfilename[256];
	unsigned int curfilesize;
}_sync_source;
int sync_data_register(char *name);
int sync_data_write(int id, char *data, int datalen);





void omc_AsciiToRbcd(BYTE * bcd_buf, const char *ascii_buf, int len);
void omc_RbcdToAscii(char *ascii_buf, const BYTE * bcd_buf, int len);
void clrscr(void);
int omcLogInit(const char *logFilePath, const char *logFileName,
			   FILE ** logFp);
void omcLog(FILE * logFp, const char *fmt, ...);
void StringCut(char *str, int c);
void exitLog(const char *fmt, ...);
void ems_debug(char *file,const char *fmt,...);
void time_mark_start(char *desc);
unsigned long time_mark_end();

#endif
