/*
  v 1.1 by Winson 2018.10.2
  Add demo parameter

  v 1.0 by Winson 2017.4.7
  Create first version
  This demo for LX-Series PAC only.
*/

#include <stdio.h>
#include <msw.h>
#include <getopt.h>

void usage();
char* const short_options = "hvs";
struct option long_options[] = {
        {"help", 0, NULL, 'h'},
        {"version", 0, NULL, 'v'},
        {"support", 0, NULL, 's'},
        {0, 0, 0, 0},
};

unsigned char rsw; 

int main(int argc, char *argv[])
{
	int wRetVal, c;

	while((c = getopt_long (argc, argv, short_options, long_options, NULL)) != -1)
        {
                switch(c)
                {
                        case 'h':
                                usage();
                                return 0;
                        break;
                        case 'v':
                                printf("SDK version = %s \n",GetSDKversion());
                                return 0;
                        break;
                        case 's':
                                printf("Support LX-8x31, LX-9x71, LX-9x81\n");
                                return 0;
                        break;
                        default:
                                printf("Try `rotary_sw -h' for more information.\n");
                                return 0;
                        break;
                }
        }

        wRetVal = Open_Slot(9);

	rsw = GetRotaryID(9);

	printf("Read Rorary switch ID : %d \n", rsw);

        Close_Slot(9);
	return 0;
}

void usage()
{
        printf("Read Rotary switch ID.\n");
        printf("-h,     display this help and exit\n");
        printf("-v,     appear used lib version\n");
        printf("-s,     support LinPAC platform\n");
}
