#include "pds700.h"

int main(int argc, char *argv[])
{
	WORD rs;
        pds_mod_t mod;

	if (argc!= 3)
	{
		fprintf(stderr,"Usage:%s [PDS ip] [COM number]\a\n",argv[0]);
		exit(1);
	}

	memset(&mod, 0, sizeof(pds_mod_t));
	rs = Open_Com(&mod, argv[1], 10000, atoi(argv[2]), 115200, 8, 0, 1);
	if(rs)
        {
               	printf("Error Code %d : Open PDS-700 COM%d Error\n", rs, atoi(argv[2]));
		exit(1);
        }

	rs = Clear_PDS_Buffer(&mod,atoi(argv[2]));

	if(rs)
		return rs;

	printf("Clear COM%d buffer OK.\n",atoi(argv[2]));
	Close_Module(&mod);
}
