This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 编译器/CC2564:如何通过 HID 协议传输中文字符?

Guru**** 2587365 points
Other Parts Discussed in Thread: CC2564

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/909789/compiler-cc2564-how-to-transmit-chinese-characters-through-hid-protocol

器件型号:CC2564

工具/软件:TI C/C++编译器

您好!

  我使用 STM32的 cc2564b 的 ti-hiddemo。 现在我将 cc2564模块设置为 devie、thecc2564模块已连接到 PC、现在我已经实现了通过 hid。将字符或中文字符(GBK 代码)发送到计算机 TXT、但某些中文字符的 GBK 代码无法发送。

  例如:

      )字符:闫 GBK 码:(0xE3C6 (__LW_AT__至 Dec 58310)   

HIDOneByteBuffer[8]= 40 00 00 00 00 00 00 00    HID_Data_Write (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=40 00 5D 00 00 00 00 00 HID_Data_Write     (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);   
HIDOneByteBuffer[8]=40 00 60 00 00 00 00 00 HID_Data_Write     (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=40 00 5B 00 00 00 00 00 HID_Data_Write     (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=40 00 59 00 00 00 00 00 HID_Data_Write     (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=40 00 62 00 00 00 00 00 HID_Data_Write      (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]= 40 00 00 00 00 00 00 00      HID_Data_Write (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=00 00 00 00 00 00      HID_Data_Write (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);

 通过上述方法,我可以成功地将“闫”发送 到计算机的 TXT 文本。

   )字符:青 GBK 码:(0xC7E0 (__LW_AT__至 Dec 51168)   

HIDOneByteBuffer[8]= 40 00 00 00 00 00 00 00     HID_Data_Write (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
 HIDOneByteBuffer[8]=40 00 5D 00 00 00 00 00 HID_Data_Write  (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]= 40 00 59 00 00 00 00 00 HID_Data_Write    (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]= 40 00 59 00 00 00 00 00 HID_Data_Write     (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=40 00 5E 00 00 00 00 00 HID_Data_Write     (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=40 00 60 00 00 00 00 00 HID_Data_Write    (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]= 40 00 00 00 00 00 00 00     HID_Data_Write (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);
HIDOneByteBuffer[8]=00 00 00 00 00 00     HID_Data_Write (BluetoothStackID、HIDID、0x01、8、HIDOneByteBuffer);

我无法通过上述方法将“青”发送到计算机的 TXT 文本。

经过几次测试后、一些中文字符无法传输?

但我可以保证不能传输到 TXT 文本的中文字符对应的 GBK 代码是正确的。如何解决这个问题?

 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    有些字符被传输、而另一些字符没有传输、这毫无意义。 是否正在检查 HID_Data_Write 中的错误? 如果您没有遇到错误、我猜是字符本身未被发送或可能被正确解释。

    Jesu

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

     您好、Jesu:

         我使用 USB 工具抓取计算机上的数据包,并在使用"Hid_Data_Write"函数 发送"51168"时找到   该工具,"Hid_Data_Write"的函数返回成功(Result = 0) ,但是,计算机上的 USB 工具仅接收"5168 "。

         同时,我测试了 GBK 代码“45772”(蔡)和“54470”(云),计算机上收到的数据为“4572”和“5470”。

         如何解决此问题?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您能否描述您在 PC 上的设置(例如软件和硬件)? 您还想从哪种 HID 设备接收数据?

    Jesu