forked from gary/ems
2
0
Fork 0

更新库

This commit is contained in:
ahu_gq 2025-05-27 11:25:36 +08:00
parent d1ed5e50e9
commit 14a945c2c5
6 changed files with 45 additions and 3 deletions

Binary file not shown.

View File

@ -1,3 +1,7 @@
1.使用clib文件步骤如下
cd到clib
cd到/opt/ems/clib
然后解压 tar -xzvf clib.tar.gz
2.同时将aarch64中文件cp到系统位置
cd /opt/ems/clib/aarch64/
cp * /usr/lib/aarch64-linux-gnu/ -rf
3.再次执行c程序、web程序即可

View File

@ -543,7 +543,7 @@ typedef struct
uint8_t bitNum; // 位数量
uint8_t isPersisted; // 是否持久化0否1是
float_t precision; // 精度
float_t ratio; // 比例,使用 float 以表示小数
double ratio; // 比例,使用 float 以表示小数
float_t offset; // 偏移量,使用 float 以表示小数
float_t mutateBound; // 变更边界
double_t value; // 采集值

34
python-demo/demoso.py Normal file
View File

@ -0,0 +1,34 @@
import ctypes
import time
import os
# 加载当前目录下的 so 文件
so_path = os.path.abspath("/usr/lib/aarch64-linux-gnu/libcrtdb.so")
mylib = ctypes.CDLL(so_path)
# 声明函数原型(如果有参数和返回值的话需要详细定义)
mylib.initRtdb(0, 0, 1); # 返回值为 void
# 设置函数返回值类型为 doublectypes.c_double
mylib.getRtdbPointValue.restype = ctypes.c_double
# 定义参数类型(函数没有返回值,所以 restype 可以不写)
mylib.setRtdbPointValue.argtypes = [
ctypes.c_int, # rtdb_type_e -> int
ctypes.c_uint16, # devType
ctypes.c_uint16, # devId
ctypes.c_uint16, # pointId
ctypes.c_double # value
]
# 每隔1秒调用一次
while True:
value = mylib.getRtdbPointValue(0, 0, 0, 7);
print(f"Double value: {value}")
i_val = int(value)
print(f" 心跳 Int value: {i_val}")
mylib.setRtdbPointValue(0, 0, 0, 1, 7.0);
val = mylib.getRtdbPointValue(0, 0, 0, 1);
print(f"读取写入的值为: {val}")
time.sleep(1)

Binary file not shown.

View File

@ -1,3 +1,7 @@
1.使用clib文件步骤如下
cd到clib
cd到/opt/ems/clib
然后解压 tar -xzvf clib.tar.gz
2.同时将aarch64中文件cp到系统位置
cd /opt/ems/clib/aarch64/
cp * /usr/lib/aarch64-linux-gnu/ -rf
3.再次执行c程序、web程序即可