Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwbobo2021 committed Sep 12, 2021
1 parent 616812e commit 38e7c7e
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 24 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
gcc vc_hidraw.c -shared -fPIC -o libvc70c-hidraw.so
g++ -o test_program test.cpp ./libvc70c-hidraw.so
./test_program

10 changes: 7 additions & 3 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ using namespace std;

int main(){
if (! open_vc_multimeter_hidraw()){
cout << "VC Multimeter not found.\n";
cout << "(test_program) Error: VC Multimeter not found.\n";
return 1;
}

vc_multimeter_reading reading;

for (int i = 0; i < 100; i++){
read_vc_multimeter_hidraw(&reading);
cout << reading.str << '\n';
if (read_vc_multimeter_hidraw(&reading))
cout << reading.str << '\n';
else {
cout << "?\n";
sleep(0.1);
}
}

close_vc_multimeter_hidraw();
Expand Down
27 changes: 18 additions & 9 deletions vc_hidraw.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
// victor-vc70c-hidraw-reader 1.00

// Without any warranty.
// In the purpose of bug reporting and version identification,
// anyone who modifies the code should remain this comment and add
// a record with an email address and the modifying date included.

// Version 1.00 (2021-9-8, wuwbobo@outlook.com)
// Original version.
/*
victor-vc70c-hidraw-reader Version 1.00
A decoding program for VICTOR VC70C/86C/86D Multimeter as computer device.
Copyright (C) 2021 wuwbobo2021 <wuwbobo@outlook.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <string.h>
Expand Down
46 changes: 34 additions & 12 deletions vc_hidraw.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
// victor-vc70c-hidraw-reader 1.00
/*
victor-vc70c-hidraw-reader Version 1.00
A decoding program for VICTOR VC70C/86C/86D Multimeter as computer device.
Copyright (C) 2021 wuwbobo2021 <wuwbobo@outlook.com>
// Without any warranty.
// In the purpose of bug reporting and version identification,
// anyone who modifies the code should remain this comment and add
// a record with an email address and the modifying date included.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
// Version 1.00 (2021-9-8, wuwbobo@outlook.com)
// Original version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
This program is NOT licensed in LGPL. For personal use only,
except as permitted by XI'AN BEICHENG ELECTRONICS CO.,LTD.
It was my father's effort to decode the HID data from the VC70C
multimeter, for which he had published an VB6 program (binary)
with Socket interface:
<https://www.shoudian.org/thread-211033-1-1.html>
A decade later when I tried to write the program on Linux, I found
similar codes on Github including <https://github.com/mvneves/victor70c>,
so I decided to rewrite it in another form with some minor features included.
<https://github.com/wuwbobo2021/victor-vc70c-hidraw-reader>
*/

#ifndef VC_HIDRAW_H

Expand Down Expand Up @@ -35,16 +57,16 @@ typedef struct vc_multimeter_reading{
vc_multimeter_unit unit;
bool AC;
bool percent_unit;
bool ol;
bool low_battery_voltage;
bool ol; //open-loop
bool low_battery_voltage; //battery of multimeter itself

char str[21]; // 1 (' ' or '-') + 5 (decimal number) + 1 (' ') + 3 (numeric unit) +
// 3 (unit) + 3 (DC/AC) + 4 (low capacity indication) + 1 ('\0')
} vc_multimeter_reading;

extern bool open_vc_multimeter_hidraw();
extern void close_vc_multimeter_hidraw();
extern bool read_vc_multimeter_hidraw(vc_multimeter_reading* reading);
extern bool open_vc_multimeter_hidraw(); //return false if device not found
extern void close_vc_multimeter_hidraw(); //close hidraw handle
extern bool read_vc_multimeter_hidraw(vc_multimeter_reading* reading); //block until data received, return false if failed

#ifdef __cplusplus
}
Expand Down

0 comments on commit 38e7c7e

Please sign in to comment.