Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'reset' of null #1

Open
brainv opened this issue Mar 25, 2015 · 6 comments
Open

TypeError: Cannot read property 'reset' of null #1

brainv opened this issue Mar 25, 2015 · 6 comments
Assignees

Comments

@brainv
Copy link

brainv commented Mar 25, 2015

@soulman-is-good any idea what seems to be the problem here?

root@cmai:~/working/nodejs# nodejs ccnet.js

/root/working/nodejs/node_modules/ccnet/lib/ccnet.js:88
    command = new Buffer([self.commands[command.toLowerCase()]]);
                                       ^
TypeError: Cannot read property 'reset' of null
    at Class.extend.execute (/root/working/nodejs/node_modules/ccnet/lib/ccnet.js:88:40)
    at Object.<anonymous> (/root/working/nodejs/ccnet.js:5:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

I'm using the following example

//open serial port /dev/ttyS0 as Bill validator(0x03 - from CCNET documentation)
var ccnet = require('ccnet'),
  ccnet = new ccnet({device:'/dev/ttyS0', type:0x03});

ccnet.execute('RESET',function(err){
    if(err){
        console.error(err);
    } else {
        console.log('RESET finished');
    }
});
//OR just

ccnet.reset(function(err){
//...
});

The following are output of ls /dev/tty* | xargs setserial -g

/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3
/dev/ttyS10, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS11, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS12, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS13, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS14, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS15, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS16, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS17, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS18, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS19, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS2, UART: 16550A, Port: 0x03e8, IRQ: 5
/dev/ttyS20, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS21, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS22, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS23, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS24, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS25, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS26, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS27, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS28, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS29, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS3, UART: 16550A, Port: 0x02e8, IRQ: 7
/dev/ttyS30, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS31, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS4, UART: 16550A, Port: 0x02f0, IRQ: 10
/dev/ttyS5, UART: 16550A, Port: 0x02e0, IRQ: 10
/dev/ttyS6, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS7, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS8, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS9, UART: unknown, Port: 0x0000, IRQ: 0
@soulman-is-good
Copy link
Owner

Sorry for late answer. I hope it still helpful.
I updated repo with some fixes on this bug. BTW thank you for detailed info.

Here is the problem, for now I do not have any bill validator with ccnet protocol, so I hope you could help me handle this issue out, I would be very thankful!

Still this issue will leave hanging here until I find a way to test it out.

@lampaa
Copy link

lampaa commented Jun 30, 2015

Hi, @soulman-is-good!
I download you repo and play:

C:\Users\╨Ш╨╡╤А╤Г╤Б╨░╨╗╨╕╨╝\AppData\Roaming\npm\node_modules\ccnet\lib\ccnet.js:
88
    command = new Buffer([self.commands[command.toLowerCase()]]);
                                       ^
TypeError: Cannot read property 'reset' of null
    at Class.extend.execute (C:\Users\AppData\Roaming\npm\nod
e_modules\ccnet\lib\ccnet.js:88:40)
    at Object.<anonymous> (C:\test\jsccet\test.js:4:7)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

@soulman-is-good
Copy link
Owner

@brainv, @lampaa
Sorry guys, I forgot to publish it, my bad. Please update your ccnet version, it should be 0.0.4 now, and try again.
If it works, could you please write me back, it would be really appreciated!

@lampaa
Copy link

lampaa commented Jun 30, 2015

@soulman-is-good hi!

C:\Users\╨Ш╨╡╤А╤Г╤Б╨░╨╗╨╕╨╝\AppData\Roaming\npm\node_modules\ccnet\lib\ccnet.js:
77
    callback = this.normalizeCallback(callback);
                    ^
TypeError: undefined is not a function
    at Class.extend.waitReady (C:\Users\╨Ш╨╡╤А╤Г╤Б╨░╨╗╨╕╨╝\AppData\Roaming\npm\n
ode_modules\ccnet\lib\ccnet.js:77:21)
    at Class.extend.execute (C:\Users\╨Ш╨╡╤А╤Г╤Б╨░╨╗╨╕╨╝\AppData\Roaming\npm\nod
e_modules\ccnet\lib\ccnet.js:87:10)
    at Object.<anonymous> (C:\test\jsccet\test.js:6:8)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

@soulman-is-good
Copy link
Owner

Updated to 0.0.5

Thank you for participation!

@lampaa
Copy link

lampaa commented Jun 30, 2015

@soulman-is-good no errors, but the bill validator is not responding ...
This lib is work: https://github.com/devoll/ccnet2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants