{"action":"created","issue":{"url":"https://api.github.com/repos/node-serialport/node-serialport/issues/1506","repository_url":"https://api.github.com/repos/node-serialport/node-serialport","labels_url":"https://api.github.com/repos/node-serialport/node-serialport/issues/1506/labels{/name}","comments_url":"https://api.github.com/repos/node-serialport/node-serialport/issues/1506/comments","events_url":"https://api.github.com/repos/node-serialport/node-serialport/issues/1506/events","html_url":"https://github.com/node-serialport/node-serialport/issues/1506","id":300983507,"number":1506,"title":"Problem to receive HEX Data","user":{"login":"wendy2702","id":33424168,"avatar_url":"https://avatars3.githubusercontent.com/u/33424168?v=4","gravatar_id":"","url":"https://api.github.com/users/wendy2702","html_url":"https://github.com/wendy2702","followers_url":"https://api.github.com/users/wendy2702/followers","following_url":"https://api.github.com/users/wendy2702/following{/other_user}","gists_url":"https://api.github.com/users/wendy2702/gists{/gist_id}","starred_url":"https://api.github.com/users/wendy2702/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wendy2702/subscriptions","organizations_url":"https://api.github.com/users/wendy2702/orgs","repos_url":"https://api.github.com/users/wendy2702/repos","events_url":"https://api.github.com/users/wendy2702/events{/privacy}","received_events_url":"https://api.github.com/users/wendy2702/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-28T11:10:21Z","updated_at":"2018-02-28T18:37:28Z","closed_at":null,"author_association":"NONE","body":"- __SerialPort Version__:6.1.1\r\n- __NodeJS Version__: v6.13.0\r\n- __Operating System__ and __Hardware Platform__: RPI3 Linux Jessie\r\n\r\nHi all,\r\n\r\ni'm quite new in Javascript and git so apologize for any mistakes i made opening this issue.\r\n\r\n #I try to read data from a Heating device but i failed to receive the data via script. From Serial port sniffer i can see that the answer is coming but for some reason i did not see them at i.e. my log/console.\r\n\r\nThis is the script i used:\r\n\r\n```var SerialPort = require(\"serialport\");\r\nvar buffer = new Buffer(12);\r\nbuffer[0] = 0x10;\r\nbuffer[1] = 0x02;\r\nbuffer[2] = 0x01;\r\nbuffer[3] = 0x15;\r\nbuffer[4] = 0x00;\r\nbuffer[5] = 0x00;\r\nbuffer[6] = 0x00;\r\nbuffer[7] = 0xf3;\r\nbuffer[8] = 0x10;\r\nbuffer[9] = 0x03;\r\nbuffer[10] = 0x7c;\r\nbuffer[11] = 0x32;\r\nvar port = new SerialPort(\"/dev/ttyUSB0\", {\r\nbaudRate: 9600,\r\ndataBits : 8,\r\nparity : 'none',\r\nstopBits: 1,\r\nflowControl : false\r\n},\r\nfunction (err) {\r\nif (err) {\r\nreturn console.log('Error1: ', err.message);\r\n\r\n}\r\n\r\nport.on('data', function (data) {\r\nconsole.log('Data: ' + data);\r\nvar daten=[];\r\ndaten=data.toString('hex');\r\nsetState('Waterkotte.Daten.Rohdaten', daten & 0xFF,true);\r\nport.close();\r\n});\r\n\r\n// Flush input\r\nport.flush();\r\n\r\n// send hello\r\nport.write(buffer, function(err) {\r\nif (err) {\r\nreturn console.log('Error on write: ', err.message);\r\n\r\n}\r\nconsole.log('Daten gesendet');\r\n// port.close();\r\n});\r\n});\r\n\r\nport.on('open', function() {\r\nconsole.log('Connected');\r\n});\r\n\r\nport.on('error', function(err) {\r\nconsole.log('Error2: ', err.message);\r\n// port.close();\r\n});\r\n\r\n// close port if the script stopped (to be able to open it again)\r\nonStop(function (callback) {\r\nif (port && port.isOpen) {\r\nport.close();\r\nconsole.log('port closed');\r\n}\r\n// callback();\r\n\r\n\r\n});\r\n```\r\n\r\nIf i use the serial port sniffer tool: jpnevulator which was startet with:\r\n\r\n`jpnevulator --ascii --timing-print --tty /dev/ttyUSB0:SB9600d --read`\r\n\r\nI can see that the correct answer is coming:\r\n\r\n```\r\n2018-02-28 10:14:54.147334:\r\nFF 10 02 00 17 1F BE 12 0C 06 03 05 29 11 C0 D3 ............)...\r\n47 4E C2 C0 C0 15 DD C0 C8 E6 D8 41 13 53 E1 41 GN.........A.S.A\r\n9D B8 09 42 D3 FF 33 42 69 7D 27 42 52 38 DE C2 ...B..3Bi}'BR8..\r\n00 00 70 41 12 58 86 BE B0 D9 91 C0 E2 39 13 C1 ..pA.X.......9..\r\n2E 59 13 42 66 66 86 C0 00 00 00 00 ED FE 87 3F .Y.Bff.........?\r\n47 F5 04 41 C8 E6 D8 41 13 53 E1 41 00 00 90 41 G..A...A.S.A...A\r\n13 53 E1 41 69 7D 27 42 10 10 0B 0B 1C 02 12 96 .S.Ai}'B........\r\n03 5D 46 DE C9 1B 46 1B FD 82 45 00 00 00 00 01 .]F...F...E.....\r\n01 01 01 01 01 01 01 01 01 01 01 00 00 00 00 00 ................\r\nC7 53 00 00 02 09 25 2A 12 12 01 0D 01 E3 20 00 .S....%*...... .\r\n00 4E 5B 1D C0 82 E9 43 40 92 E6 17 40 E1 51 FE .N[....C@...@.Q.\r\n3E 09 6F 14 42 B5 8B 00 42 CC 77 1B 41 3F 3F 47 >.o.B...B.w.A??G\r\n42 02 00 00 00 A0 41 00 00 00 00 00 00 00 00 2C B.....A........,\r\nED 02 00 02 A3 20 00 20 00 00 00 02 00 00 00 00 ..... . ........\r\n00 00 00 03 01 08 08 00 00 00 00 00 00 00 01 27 ...............'\r\n00 7D 01 27 00 28 35 12 10 03 19 DF FF          .}.'.(5......\r\n```\r\nBut this Hex string i'm not able to see as \"data\" at my console/log.\r\n\r\nThis is an example feedback:\r\n\r\n```\r\n14:00:41.247   [info]   javascript.0 Stop script script.js.Skript1\r\n14:00:41.277   [info]   javascript.0 Start javascript script.js.Skript1\r\n14:00:41.278   [info]   javascript.0 script.js.Skript1: registered 0 subscriptions and 0 schedules\r\n14:00:41.279   [info]   javascript.0 script.js.Skript1: Connected\r\n14:00:41.279   [info]   javascript.0 script.js.Skript1: Daten gesendet\r\n14:00:41.391   [info]   javascript.0 script.js.Skript1: Data: d0\r\n14:00:54.192   [info]   javascript.0 Stop script script.js.Skript1\r\n14:11:15.612   [info]   javascript.0 Stop script script.js.Skript1\r\n14:11:18.807   [info]   javascript.0 Start javascript script.js.Skript1\r\n14:11:18.808   [info]   javascript.0 script.js.Skript1: registered 0 subscriptions and 0 schedules\r\n14:11:18.814   [info]   javascript.0 script.js.Skript1: Connected\r\n14:11:18.818   [info]   javascript.0 script.js.Skript1: Daten gesendet\r\n14:11:18.843   [info]   javascript.0 script.js.Skript1: Data: \r\n14:11:28.669   [info]   javascript.0 Stop script script.js.Skript1\r\n14:11:29.698   [info]   javascript.0 Start javascript script.js.Skript1\r\n14:11:29.699   [info]   javascript.0 script.js.Skript1: registered 0 subscriptions and 0 schedules\r\n14:11:29.700   [info]   javascript.0 script.js.Skript1: Connected\r\n14:11:29.700   [info]   javascript.0 script.js.Skript1: Daten gesendet\r\n14:11:29.753   [info]   javascript.0 script.js.Skript1: Data: @\r\n14:11:45.748   [info]   javascript.0 Stop script script.js.Skript1\r\n14:11:47.483   [info]   javascript.0 Start javascript script.js.Skript1\r\n14:11:47.485   [info]   javascript.0 script.js.Skript1: registered 0 subscriptions and 0 schedules\r\n14:11:47.485   [info]   javascript.0 script.js.Skript1: Connected\r\n14:11:47.485   [info]   javascript.0 script.js.Skript1: Daten gesendet\r\n```\r\n\r\nAs you can see the value for \"Data\" is different all the time.\r\n\r\nWhat i'm doing wrong?\r\n\r\nThanks for help\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/node-serialport/node-serialport/issues/comments/369338330","html_url":"https://github.com/node-serialport/node-serialport/issues/1506#issuecomment-369338330","issue_url":"https://api.github.com/repos/node-serialport/node-serialport/issues/1506","id":369338330,"user":{"login":"wendy2702","id":33424168,"avatar_url":"https://avatars3.githubusercontent.com/u/33424168?v=4","gravatar_id":"","url":"https://api.github.com/users/wendy2702","html_url":"https://github.com/wendy2702","followers_url":"https://api.github.com/users/wendy2702/followers","following_url":"https://api.github.com/users/wendy2702/following{/other_user}","gists_url":"https://api.github.com/users/wendy2702/gists{/gist_id}","starred_url":"https://api.github.com/users/wendy2702/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wendy2702/subscriptions","organizations_url":"https://api.github.com/users/wendy2702/orgs","repos_url":"https://api.github.com/users/wendy2702/repos","events_url":"https://api.github.com/users/wendy2702/events{/privacy}","received_events_url":"https://api.github.com/users/wendy2702/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T18:37:28Z","updated_at":"2018-02-28T18:37:28Z","author_association":"NONE","body":"If i change the logging to:\r\n\r\n`console.log('Data: ' + data.toString('hex'));`\r\n\r\nI got this:\r\n\r\n```\r\n\r\n19:35:56.809 | [info] | javascript.0 script.js.Skript1: Daten gesendet\r\n-- | -- | --\r\n19:35:56.836 | [info] | javascript.0 script.js.Skript1: Data: ff1002\r\n19:35:56.852 | [info] | javascript.0 script.js.Skript1: Data: 00171fbe120c06030529a00dcc\r\n19:35:56.868 | [info] | javascript.0 script.js.Skript1: Data: c0c36bd0c0fd73c0c0d525d7\r\n19:35:56.883 | [info] | javascript.0 script.js.Skript1: Data: 4118dee341276e0b42d3ff33\r\n19:35:56.899 | [info] | javascript.0 script.js.Skript1: Data: 42882b2e425238dec2000070\r\n19:35:56.916 | [info] | javascript.0 script.js.Skript1: Data: 41007c9c3bfe348fc05ad313c1\r\n19:35:56.931 | [info] | javascript.0 script.js.Skript1: Data: 70761442333373c0000000\r\n19:35:56.947 | [info] | javascript.0 script.js.Skript1: Data: 00949c873f3f190641d525d741\r\n19:35:56.963 | [info] | javascript.0 script.js.Skript1: Data: 18dee3410000904118dee34188\r\n19:35:56.980 | [info] | javascript.0 script.js.Skript1: Data: 2b2e421320141c0212b4185d\r\n19:35:57.008 | [info] | javascript.0 script.js.Skript1: Data: 4698dc1b461c018345000000\r\n19:35:57.013 | [info] | javascript.0 script.js.Skript1: Data: 000101010101010101010101\r\n19:35:57.028 | [info] | javascript.0 script.js.Skript1: Data: 010000000000c7530000020925\r\n19:35:57.043 | [info] | javascript.0 script.js.Skript1: Data: 2a1212010d01e32000004e\r\n19:35:57.061 | [info] | javascript.0 script.js.Skript1: Data: 5b1dc082e9434092e61740e151\r\n19:35:57.076 | [info] | javascript.0 script.js.Skript1: Data: fe3e096f1442b58b0042cc771b\r\n19:35:57.091 | [info] | javascript.0 script.js.Skript1: Data: 413f3f474202000000a041\r\n19:35:57.107 | [info] | javascript.0 script.js.Skript1: Data: 00000000000000002cbe020002\r\n19:35:57.123 | [info] | javascript.0 script.js.Skript1: Data: a32000200000000200000000\r\n19:35:57.139 | [info] | javascript.0 script.js.Skript1: Data: 000000030108080000000000\r\n19:35:57.155 | [info] | javascript.0 script.js.Skript1: Data: 000001270017012700283512\r\n19:35:57.171 | [info] | javascript.0 script.js.Skript1: Data: 1003848aff\r\n\r\n```\r\n\r\nIs it somehow possible to get it as one big string or is it already on string and only splitted at log?"}}
{"actor":{"display_login":"wendy2702"}}