Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/FeliCa2Money-1/felicalib.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 204 - (show annotations) (download) (as text)
Sun May 18 04:21:26 2008 UTC (15 years, 10 months ago) by tmurakam
File MIME type: text/x-chdr
File size: 3747 byte(s)
Move older version (ver 1.x)

1 /*
2 felicalib - FeliCa access wrapper library
3
4 Copyright (c) 2007, Takuya Murakami, All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16
17 3. Neither the name of the project nor the names of its contributors
18 may be used to endorse or promote products derived from this software
19 without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 /**
34 @file felicalib.h
35
36 ���C���w�b�_
37 */
38 /**
39 @mainpage
40
41 API �d�l�����������A felicalib.h ���Q���������B
42 */
43 #ifndef _FELICALIB_H
44 #define _FELICALIB_H
45
46 #include <windows.h>
47 #include <tchar.h>
48
49 typedef unsigned char uint8;
50 typedef unsigned short int uint16;
51
52 typedef struct strpasori pasori;
53
54 #define MAX_SYSTEM_CODE 8
55 #define MAX_AREA_CODE 16
56 #define MAX_SERVICE_CODE 256
57
58 /**
59 @brief FeliCa �n���h��
60
61 FeliCa ���������i�[�����\����
62 */
63 typedef struct strfelica {
64 pasori *p; /**< PaSoRi �n���h�� */
65 uint16 systemcode; /**< �V�X�e���R�[�h */
66 uint8 IDm[8]; /**< IDm */
67 uint8 PMm[8]; /**< PMm */
68
69 /* systemcode */
70 uint8 num_system_code; /**< �����V�X�e���R�[�h�� */
71 uint16 system_code[MAX_SYSTEM_CODE]; /**< �����V�X�e���R�[�h */
72
73 /* area/service codes */
74 uint8 num_area_code; /**< �G���A�R�[�h�� */
75 uint16 area_code[MAX_AREA_CODE]; /**< �G���A�R�[�h */
76 uint16 end_service_code[MAX_AREA_CODE]; /**< �G���h�T�[�r�X�R�[�h */
77
78 uint8 num_service_code; /**< �T�[�r�X�R�[�h�� */
79 uint16 service_code[MAX_SERVICE_CODE]; /**< �T�[�r�X�R�[�h */
80 } felica;
81
82 /* constants */
83 /* �V�X�e���R�[�h (�l�b�g���[�N�o�C�g�I�[�_/�r�b�N�G���f�B�A�����\�L) */
84 #define POLLING_ANY 0xffff
85 #define POLLING_EDY 0xfe00 /**< �V�X�e���R�[�h: �������� (Edy �������g�p) */
86 #define POLLING_SUICA 0x0003 /**< �V�X�e���R�[�h: �T�C�o�l���� */
87
88 /* endian */
89 /** �l�b�g���[�N�o�C�g�I�[�_�����z�X�g�o�C�g�I�[�_��������(16bit) */
90 #define N2HS(x) (((x) >> 8) & 0xff | ((x) << 8) & 0xff00)
91 /** �z�X�g�o�C�g�I�[�_�����l�b�g���[�N�o�C�g�I�[�_��������(16bit) */
92 #define H2NS(x) N2HS(x)
93
94 /* APIs */
95 #ifdef __cplusplus
96 extern "C" {
97 #endif
98
99 pasori *pasori_open(char *);
100 void pasori_close(pasori *);
101
102 int pasori_init(pasori *);
103 felica* felica_polling(pasori *, uint16, uint8, uint8);
104 int felica_read_without_encryption02(felica *f, int servicecode, int mode, uint8 addr, uint8 *b);
105
106 felica * felica_enum_systemcode(pasori *p);
107 felica * felica_enum_service(pasori *p, uint16 systemcode);
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif /* _FELICALIB_H */
114

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26