TCOM5. Пример драйвера t12

 

int count=0;

void rrr(char *);

void rrr(char *str)

{

FILE *fx;

fx=fopen("e:\\bbb","a");

fprintf(fx,"%s %d\n",str,count);

fclose(fx);

}

int OpenMedia(long &hndl)

{

hndl=1;

rrr("OpenMedia");

return(0);

}

int CloseMedia(long &hndl)

{

rrr("CloseMedia");

return(0);

}

int StartMedia(long &hndl)

{

rrr("StartMedia");

return(0);

}

int StopMedia(long &hndl)

{

rrr("StopMedia");

return(0);

}

int WriteMedia(long &hndl, char *sbuf, int out_count, int &actual_count)

{

rrr("WRITE");

rrr(sbuf);

return(0);

}

int ReadMedia(long &hndl, char *rbuf, int in_count, int &actual_count)

{

rrr("READ");

count++;

return(0);

}

.........

int Set_yyy(IA &ia,int &max_send,int &max_rec,RSDATA *p,char *sbuf)

{

sprintf(sbuf,"%.2d %.8d\n",(int)ia.c[2],time(NULL) );

max_send=strlen(sbuf);

max_rec=10;

return(0);

}

int Get_yyy(IA &ia,int &count_rec,int &q_rec,RSDATA *p,char *rbuf,int &type_cnv)

{

q_rec=1;

type_cnv=0;

p[0].V.v=ia.c[2];

p[0].F.fmt[0]=p[0].F.fmt[1]=0;

return(0);

}

int Check_yyy(IA &ia,int &count_rec,int &max_rec,char *rbuf)

{

return(0);

}

int zCompare_yyy(IA &ia0,IA &ia1,int &count)

{

if (ia0.c[2] == ia1.c[2])

return(1);

 else return(0);

}

int Open_yyy(int &media,char *str,int &q_in,int &q_out,int &q_data)

{

q_data=128;

media=0;

q_in=1024;

q_out=1024;

return(0);

}

int Close_yyy()

{

return(0);

}