Skip to content

Commit 778344b

Browse files
committed
Add API to get serial number as bytes
1 parent f989765 commit 778344b

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/ECCX08.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,29 @@ void ECCX08Class::end()
6161
#endif
6262
}
6363

64-
String ECCX08Class::serialNumber()
64+
int ECCX08Class::serialNumber(byte sn[])
6565
{
66-
String result = (char*)NULL;
67-
byte sn[12];
68-
6966
if (!read(0, 0, &sn[0], 4)) {
70-
return result;
67+
return 0;
7168
}
7269

7370
if (!read(0, 2, &sn[4], 4)) {
74-
return result;
71+
return 0;
7572
}
7673

7774
if (!read(0, 3, &sn[8], 4)) {
75+
return 0;
76+
}
77+
78+
return 1;
79+
}
80+
81+
String ECCX08Class::serialNumber()
82+
{
83+
String result = (char*)NULL;
84+
byte sn[12];
85+
86+
if (!serialNumber(sn)) {
7887
return result;
7988
}
8089

src/ECCX08.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ECCX08Class
3232
int begin();
3333
void end();
3434

35+
int serialNumber(byte sn[]);
3536
String serialNumber();
3637

3738
long random(long max);

0 commit comments

Comments
 (0)