Adobe Air 和串行端口与 Serproxy/Thinkerproxy 的通信

发布于 2024-11-07 22:07:13 字数 4739 浏览 0 评论 0原文

我在小型 Air 应用程序中使用 serproxy / thinkerproxy 进行串行通信。 我有两个硬件设备来测试它。一个是条形码扫描仪,它工作得很好。

另一种是定制板。这也是一种工作。问题是字符不可读。我认为这是字符集的问题(不确定),所以我在处理 ProgressEvent.SOCKET_DATA 事件的函数中尝试了类似的操作:

var cs:Array = new Array(   'ISO-8859-1',
                                            'ISO-8859-2',
                                            'ISO-8859-3',
                                            'ISO-8859-4',
                                            'ISO-8859-5',
                                            'ISO-8859-6',
                                            'ISO-8859-7',
                                            'ISO-8859-8',
                                            'ISO-8859-9',
                                            'ISO-8859-10',
                                            'ISO-8859-11',
                                            'ISO-8859-12',
                                            'ISO-8859-13',
                                            'ISO-8859-14',
                                            'ISO-8859-15',
                                            'ISO-8859-16',
                                            'ISO-8859-17',
                                            'ISO-8859-18',
                                            'ISO-8859-19',
                                            'ISO-8859-20',
                                            'ASMO-708',
                                            'DOS-720',
                                            'x-mac-arabic',
                                            'windows-1256',
                                            'ibm775',
                                            'windows-1257',
                                            'ibm852',
                                            'x-mac-ce',
                                            'windows-1250',
                                            'gb18030',
                                            'EUC-CN',
                                            'gb2312',
                                            'gb18030',
                                            'hz-gb-2312',
                                            'x-mac-chinesesimp',
                                            'big5',
                                            'x-Chinese-CNS',
                                            'x-Chinese-Eten',
                                            'x-mac-chinesetrad',
                                            'cp866',
                                            'koi8-r',
                                            'koi8-u',
                                            'x-mac-greek',
                                            'windows-1253',
                                            'ibm869',
                                            'DOS-862',
                                            'iso-8859-8-i',
                                            'x-mac-hebrew',
                                            'windows-1255',
                                            'x-EBCDIC-Arabic',
                                            'x-EBCDIC-CyrillicRussian',
                                            'x-EBCDIC-CyrillicSerbianBulgarian',
                                            'x-EBCDIC-DenmarkNorway',
                                            'x-ebcdic-denmarknorway-euro',
                                            'x-EBCDIC-FinlandSweden',
                                            'x-ebcdic-finlandsweden-euro',
                                            'x-ebcdic-finlandsweden-euro',
                                            'x-iscii-as',
                                            'unicode',
                                            'unicodeFFFE',
                                            'utf-7',
                                            'utf-8',
                                            'us-ascii',
                                            'windows-1258',
                                            'x-IA5',
                                            'Windows-1252'
                                        );

                for each(var csStr:String in cs){

                    var info:String = _socket.readMultiByte(_socket.bytesAvailable, csStr);
                    temp = csStr + ":" + info;

                    if(info.length > 0)
                        dispatchEvent(new TextEvent(EVENT_ON_DATA_RECEIVED, false, false, temp) );
                }

包含值的唯一值是 ISO-8859-1。它看起来像这样:在此处输入图像描述

自定义板应该发送类似以下内容的内容:0x40< /strong>

所以,不确定这里最好的方法是什么(我知道我可以尝试更多的字符集)。有什么想法吗?

I'm using serproxy / thinkerproxy for serial communication in a small Air app.
I have two hardware devices to test it. One is a barcode scanner, it works perfectly.

The other is a custom board. It's kind of working also. The problem is that the characters are unreadable. I think it's a problem of charset (not sure) so I tried something like this in the function that handles the ProgressEvent.SOCKET_DATA event:

var cs:Array = new Array(   'ISO-8859-1',
                                            'ISO-8859-2',
                                            'ISO-8859-3',
                                            'ISO-8859-4',
                                            'ISO-8859-5',
                                            'ISO-8859-6',
                                            'ISO-8859-7',
                                            'ISO-8859-8',
                                            'ISO-8859-9',
                                            'ISO-8859-10',
                                            'ISO-8859-11',
                                            'ISO-8859-12',
                                            'ISO-8859-13',
                                            'ISO-8859-14',
                                            'ISO-8859-15',
                                            'ISO-8859-16',
                                            'ISO-8859-17',
                                            'ISO-8859-18',
                                            'ISO-8859-19',
                                            'ISO-8859-20',
                                            'ASMO-708',
                                            'DOS-720',
                                            'x-mac-arabic',
                                            'windows-1256',
                                            'ibm775',
                                            'windows-1257',
                                            'ibm852',
                                            'x-mac-ce',
                                            'windows-1250',
                                            'gb18030',
                                            'EUC-CN',
                                            'gb2312',
                                            'gb18030',
                                            'hz-gb-2312',
                                            'x-mac-chinesesimp',
                                            'big5',
                                            'x-Chinese-CNS',
                                            'x-Chinese-Eten',
                                            'x-mac-chinesetrad',
                                            'cp866',
                                            'koi8-r',
                                            'koi8-u',
                                            'x-mac-greek',
                                            'windows-1253',
                                            'ibm869',
                                            'DOS-862',
                                            'iso-8859-8-i',
                                            'x-mac-hebrew',
                                            'windows-1255',
                                            'x-EBCDIC-Arabic',
                                            'x-EBCDIC-CyrillicRussian',
                                            'x-EBCDIC-CyrillicSerbianBulgarian',
                                            'x-EBCDIC-DenmarkNorway',
                                            'x-ebcdic-denmarknorway-euro',
                                            'x-EBCDIC-FinlandSweden',
                                            'x-ebcdic-finlandsweden-euro',
                                            'x-ebcdic-finlandsweden-euro',
                                            'x-iscii-as',
                                            'unicode',
                                            'unicodeFFFE',
                                            'utf-7',
                                            'utf-8',
                                            'us-ascii',
                                            'windows-1258',
                                            'x-IA5',
                                            'Windows-1252'
                                        );

                for each(var csStr:String in cs){

                    var info:String = _socket.readMultiByte(_socket.bytesAvailable, csStr);
                    temp = csStr + ":" + info;

                    if(info.length > 0)
                        dispatchEvent(new TextEvent(EVENT_ON_DATA_RECEIVED, false, false, temp) );
                }

The only value that contains a value is ISO-8859-1. and and it looks like this:enter image description here

The custom board is supposed to send something like : 0x40

So, not sure what is the best approach here (I know there are more charset I can try). Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风轻花落早 2024-11-14 22:07:13

您是否想猜测未知的编码?查看板发送的原始字节以检查它们是否已移位。

Are you trying to guess unknown encoding? Look at raw bytes that board sends to check whether they are bit-shifted.

一杯敬自由 2024-11-14 22:07:13

您检查过您的设置吗?我怀疑奇偶校验位的设置不同。

Have you checked your settings - I'd suspect differing settings for parity bit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文