/*  Copyright (C) MOXA Inc. All rights reserved.

    This software is distributed under the terms of the
    MOXA License.  See the file COPYING-MOXA for details.
*/
/*
    mxcan_read.cpp

    This is for the read of canbus data.

    2010-10-31	Epson Chiang
		new release
*/

#include "stdafx.h"
#include "stdafx.h"
#include <windows.h>
#include "..\SDK\mxcanbus.h"

int _tmain(int argc, _TCHAR* argv[])
{
	CANPRM param;
	
	//unsigned int nRet;
	DWORD nRet;
	int fd;
	
	int port = 0;

	printf("Enter can port number:");
	scanf("%d",&port);

	/*Open can port*/
	fd =  mxcan_open(port);

	if (mxcan_get_parameters(fd, &param))
	{
		printf("mxcan_get_parameters fail\r\n");
		return -1;
	}

	printf("param.bus_timing=%d\r\n",param.bus_timing);
	printf("param.acceptance_filter_mode=%d\r\n",param.acceptance_filter_mode);
	printf("param.acceptance_filter_code=0x%x\r\n",param.acceptance_filter_code);
	printf("param.acceptance_filter_mask=0x%x\r\n",param.acceptance_filter_mask);

	/*Close can port*/
	mxcan_close(fd);
	return 0;
}

