Пример #1
0
//int _tmain(int argc, _TCHAR *argv[])
int main()
{
    pasori *p;
    felica *f;

	read_config("LowsanFelica.ini");
	p = pasori_open(NULL);
	if (!p) {
		pasori_close(p);
		exit(2);
	}

	pasori_init(p);

	while(1){
		Sleep(200);
		if (!p) {
			continue;
		}
		//polling
		f = felica_polling(p, POLLING_ANY, 0, 0);
		if (!f) {
			continue;
		}else{
			transID(f);
			felica_free(f);
			Sleep(5000);
		}
	}
	felica_free(f);
	pasori_close(p);
    return 0;
}
Пример #2
0
int _tmain(int argc, _TCHAR *argv[])
{
    pasori *p;
    felica *f;
    int i;
    uint8 data[16];

    p = pasori_open(NULL);
    if (!p) {
        fprintf(stderr, "PaSoRi open failed.\n");
        exit(1);
    }
    pasori_init(p);
    
    f = felica_polling(p, POLLING_EDY, 0, 0);
    if (!f) {
        fprintf(stderr, "Polling card failed.\n");
        exit(1);
    }

    printf("IDm: ");
    for (i = 0; i < 8; i++) {
        printf("%02x", f->IDm[i]);
    }
    printf("\n");

    for (i = 0; ; i++) {
        if (felica_read_without_encryption02(f, SERVICE_EDY, 0, (uint8)i, data)) {
            break;
        }
        edy_dump(data);
    }
    felica_free(f);
    pasori_close(p);

    return 0;
}
Пример #3
0
int _tmain(int argc, _TCHAR *argv[])
{
    pasori *p;
    felica *f, *f2;
    int i, j, k;

    p = pasori_open(NULL);
    if (!p) {
        fprintf(stderr, "PaSoRi open failed.\n");
        exit(1);
    }
    pasori_init(p);
    
    f = felica_polling(p, POLLING_ANY, 0, 0);
    if (!f) {
        fprintf(stderr, "Polling card failed.\n");
        exit(1);
    }
    printf("# IDm: ");
    hexdump(f->IDm, 8);
    printf("\n");
    printf("# PMm: ");
    hexdump(f->PMm, 8);
    printf("\n\n");
    felica_free(f);

    f = felica_enum_systemcode(p);
    if (!f) {
        exit(1);
    }

    for (i = 0; i < f->num_system_code; i++) {
        printf("# System code: %04X\n", N2HS(f->system_code[i]));
        f2 = felica_enum_service(p, N2HS(f->system_code[i]));
        if (!f2) {
            fprintf(stderr, "Enum service failed.\n");
            exit(1);
        }
        
        printf("# Number of area = %d\n", f2->num_area_code);
        for (j = 0; j < f2->num_area_code; j++) {
            printf("# Area: %04X - %04X\n", f2->area_code[j], f2->end_service_code[j]);
        }            

        printf("# Number of service code = %d\n", f2->num_service_code);
        for (j = 0; j < f2->num_service_code; j++) {
            uint16 service = f2->service_code[j];
            printserviceinfo(service);

            for (k = 0; k < 255; k++) {
                uint8 data[16];

                if (felica_read_without_encryption02(f2, service, 0, (uint8)k, data)) {
                    break;
                }
                
                printf("%04X:%04X ", service, k);
                hexdump(data, 16);
                printf("\n");
            }
        }
        printf("\n");
        felica_free(f2);
    }

    felica_free(f);
    pasori_close(p);

    return 0;
}
Пример #4
0
int _tmain(int argc, _TCHAR *argv[])
{
    pasori *p;
    felica *f, *f2;
    int i, j, k;


    read_config("LowsanFelica.ini");

    while(1) {
        Sleep(1000);
        p = pasori_open(NULL);
        if (!p) {
            continue;
            //exit(1);
        }
        pasori_init(p);

        f = felica_polling(p, POLLING_ANY, 0, 0);
        if (!f) {
            felica_free(f);
            pasori_close(p);
            continue;
        }

        transID(f);
        felica_free(f);

        f = felica_enum_systemcode(p);
        if (!f) {
            //exit(1);
            continue;
        }

        for (i = 0; i < f->num_system_code; i++) {

            f2 = felica_enum_service(p, N2HS(f->system_code[i]));
            if (!f2) {

                continue;
                //exit(1);
            }

            for (j = 0; j < f2->num_area_code; j++) {
            }

            for (j = 0; j < f2->num_service_code; j++) {
                uint16 service = f2->service_code[j];
                //printserviceinfo(service);

                for (k = 0; k < 255; k++) {
                    uint8 data[16];

                    if (felica_read_without_encryption02(f2, service, 0, (uint8)k, data)) {
                        break;
                    }

                }
            }
        }
        pasori_close(p);
    }
    felica_free(f2);
    felica_free(f);
    pasori_close(p);

    return 0;
}