上篇文章说过在本地买的华夏相机T83因为当地的销售人员只懂安装,一点技术支持也给不了,导致语音/屏幕 均不能实现自己想要的功能(自定义修改文字,语音播放余额等),经过自己进一步的研究发现,这个led屏幕和语音只需要自己买一块几十块的主板更换上对接就可以
上篇文章:华夏相机开发/臻识相机开发/车牌识别器开发对接使用总结
1. 这是对接资料
2. 通过文档以及demo更改的javaDemo工具类
/**
* LED
*
* @author Lion 157239486@qq.com
* @since 1.0.0 2022-12-28
*/
public class DucpUtils {
public static final int LED_COLOR_RED = 0x000000FF; //红色
public static final int LED_COLOR_GREEN = 0x0000FF00; //绿色
public static final int LED_COLOR_YEELOW = 0x0000FFFF; //黄色
public final int[] ColorMap = new int[]{0xff, 0xff00, 0xff0000, 0xffff, 0xffff00, 0xff00ff, 0xffffff, 0x000000};
//{
// "静态显示",
// "向左移动",
// "向右移动",
// "向上移动",
// "向下移动",
// "向左展开",
// "向右展开"}
public static final void Camera485Transmission(SDK sdk, byte[] Buff, int Len) {
//相机透传的接口 发送协议数据
sdk.ICE_IPCSDK_TransSerialPort(Buff);
}
public static void LED_MuiltLineDisAndPlayVoice(SDK sdk, TextContext[] TextContext, String VoiceText, int SaveFlag) {
int BuffPos;
byte[] Buff = new byte[255]; //分配缓冲数组
int CRC;
byte TextContextNum = (byte) TextContext.length;
/*0.填充命令参数*/
BuffPos = 0;
Buff[BuffPos++] = 0x00; //显示屏地址
Buff[BuffPos++] = 0x64; //固定参数
Buff[BuffPos++] = (byte) 0xFF; //包序列
Buff[BuffPos++] = (byte) 0xFF; //包序列
Buff[BuffPos++] = 0x6E; //指令
Buff[BuffPos++] = 0; //数据长度
/*1.填充文本参数*/
Buff[BuffPos++] = (byte) SaveFlag; //文本类型,1为广告语,0为临时信息
Buff[BuffPos++] = TextContextNum; //文本数量
for (int i = 0; i < TextContextNum; i++) {
Buff[BuffPos++] = (byte) TextContext[i].lid; //行号
Buff[BuffPos++] = (byte) TextContext[i].disMode; //显示模式
Buff[BuffPos++] = 0x01; //显示速度
Buff[BuffPos++] = (byte) TextContext[i].delayTime; //停留时间
Buff[BuffPos++] = (byte) TextContext[i].disTimes; //显示次数
Buff[BuffPos++] = (byte) (TextContext[i].textColor & 0xff); //32位字体颜色 红色分量
Buff[BuffPos++] = (byte) ((TextContext[i].textColor >> 8) & 0xff); //32位字体颜色 绿色分量
Buff[BuffPos++] = (byte) ((TextContext[i].textColor >> 16) & 0xff); //32位字体颜色 蓝色分量
Buff[BuffPos++] = (byte) ((TextContext[i].textColor >> 24) & 0xff); //32位字体颜色 保留字节
byte[] TextBuff = TextContext[i].Text.getBytes(); //把string 类型字符串 读取到字节数组里面.注意字符串编码必须是GB2312 WINDOWS代码页为936
if ((BuffPos + TextBuff.length) >= 255) { //整包长度不能大于255
return;
}
Buff[BuffPos++] = (byte) TextBuff.length; //文本长度
for (int z = 0; z < TextBuff.length; z++) //复制文本到缓冲
{
Buff[BuffPos++] = TextBuff[z];
}
if (i == (TextContextNum - 1)) { //添加文本分隔符
Buff[BuffPos++] = 0x00;
} else {
Buff[BuffPos++] = 0x0D;
}
}
/*2.填充语音参数*/
byte[] VoiceTextBuff = VoiceText.getBytes(); //把string 类型字符串 读取到字节数组里面.注意字符串编码必须是GB2312 WINDOWS代码页为936
if (VoiceTextBuff.length > 0) {
Buff[BuffPos++] = 0x0A; //语音分隔符
Buff[BuffPos++] = (byte) VoiceTextBuff.length; //语音文本长度
if ((BuffPos + VoiceTextBuff.length) >= 255) { //长度检查
return;
}
for (int z = 0; z < VoiceTextBuff.length; z++) //复制文本到缓冲
{
Buff[BuffPos++] = VoiceTextBuff[z];
}
} else {
Buff[BuffPos++] = 0x00;
}
Buff[BuffPos++] = 0;
Buff[5] = (byte) (BuffPos - 6); //重新修改数据长度
/*3.计算校验码*/
CRC = MB_CRC16(Buff, BuffPos);
Buff[BuffPos++] = (byte) (CRC & 0xff); //校验码低字节
Buff[BuffPos++] = (byte) ((CRC >>> 8) & 0xff); //校验码高字节
/*4.最后在这里把Buff的内容发送出去,长度为BuffPos */
Camera485Transmission(sdk, Buff, BuffPos);
}
public static int byteToInteger(byte b) {
int value;
value = b & 0xff;
return value;
}
}
代码均有注释就不单独做说明了
注意:这种方式是通过相机SDK透传,华夏相机/臻识相机只需要更换Camera485Transmission这个方法里的sdk即可。