Flummoxed by checksum BXOR operation
fogled@mizzou
Posts: 549
First time trying to talk to a BSS Audio device. For the record, I despise cryptic API's like this that require checksums. Seriously... WHY?!?
Anyway, here's my current code:
The rest of the function seems to operate OK, but the BXOR function doesn't seem to work.
Here's what I'm getting:
Like I said, it looks like the rest of the function is stepping through the characters correctly, but... I don't understand why I'm always just getting $00 as a result no matter what the BXOR operation is. Can someone please tell me what I'm doing wrong to get invalid results with a BXOR?
(NOTE: my debug call just sends to a virtual port which creates a duplicate entry, that's why my results are all odd numbered lines, I just cut out the duplicate lines)
Anyway, here's my current code:
define_function char bsschecksum (char this_string[]) { stack_var char this_sum[1] stack_var char this_char[1] this_sum = "$00" call 'debug' ("'Checksum Start: ',this_string,' CHK:',this_sum") while ( length_string(this_string) > 0 ) { this_char = left_string(this_string,1) call 'debug' ("'Checksum Current Char: ',this_char") remove_string(this_string,this_char,1) call 'debug' ("'Remaining String to Checksum: ',this_string") call 'debug' ("'The checksum process: ',this_sum,' BXOR ',this_char") this_sum = this_sum BXOR this_char call 'debug' ("'Checksum PRocess Result: ',this_sum") } return this_sum; }
The rest of the function seems to operate OK, but the BXOR function doesn't seem to work.
Here's what I'm getting:
Line 17 (14:43:05):: String To [33013:1:1]-[Checksum Start: $88X$A1$03$00$01$0E$01$00$00$00$00 CHK:$00] Line 19 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $88] Line 21 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: X$A1$03$00$01$0E$01$00$00$00$00] Line 23 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $88] Line 25 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 27 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: X] Line 29 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $A1$03$00$01$0E$01$00$00$00$00] Line 31 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR X] Line 33 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 35 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $A1] Line 37 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $03$00$01$0E$01$00$00$00$00] Line 39 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $A1] Line 41 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 43 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $03] Line 45 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $00$01$0E$01$00$00$00$00] Line 47 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $03] Line 49 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 51 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $00] Line 53 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $01$0E$01$00$00$00$00] Line 55 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $00] Line 57 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 59 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $01] Line 61 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $0E$01$00$00$00$00] Line 63 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $01] Line 65 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 67 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $0E] Line 69 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $01$00$00$00$00] Line 71 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $0E] Line 73 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 75 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $01] Line 77 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $00$00$00$00] Line 79 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $01] Line 81 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 83 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $00] Line 85 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $00$00$00] Line 87 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $00] Line 89 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 91 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $00] Line 93 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $00$00] Line 95 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $00] Line 97 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 99 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $00] Line 101 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: $00] Line 103 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $00] Line 105 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00] Line 107 (14:43:05):: String To [33013:1:1]-[Checksum Current Char: $00] Line 109 (14:43:05):: String To [33013:1:1]-[Remaining String to Checksum: ] Line 111 (14:43:05):: String To [33013:1:1]-[The checksum process: $00 BXOR $00] Line 113 (14:43:05):: String To [33013:1:1]-[Checksum PRocess Result: $00]
Like I said, it looks like the rest of the function is stepping through the characters correctly, but... I don't understand why I'm always just getting $00 as a result no matter what the BXOR operation is. Can someone please tell me what I'm doing wrong to get invalid results with a BXOR?
(NOTE: my debug call just sends to a virtual port which creates a duplicate entry, that's why my results are all odd numbered lines, I just cut out the duplicate lines)
0
Comments
E
Clue #1
When you compile your code, you should be getting a couple of these warnings:
Clue #2
When you run the code, you should be seeing these run-time errors every time thru the loop if you monitor Diagnostics:
Netlinx and 1 character arrays do not always play nice.
Try changing your function to this:
I don?t know if your checksum routine is correct and doing what it should but the BXOR is calculating correctly now:
Hope this helps.
Unfortunately I'm not going to be able to test this code for a bit; the site I was working at has no internet connectivity yet, and not even any cell phone service. I've made an issue out of refusing to do any more work out there until I've got internet connectivity on site. That could be weeks.
Here's the link for you.
Have fun.
Yep my mistake. I left the quotes around the $00 in the [this_sum = "$00"] line. Thanks!
ha!
Indeed,
I (seriously) had a ban on them prior to AMX/Harman/Samsung buying them. If it showed up in a project I took a pass. It's not only the protocol that is nightmarish. (and don't even get me started on trying to troubleshoot on-site with this protocol) But, it is - in and of itself - flaky. The whole concept of 'Subscribe" to feedback from something doesn't work the way one would think. Just because you subscribe to something doesn't usually mean you'll get continuous feedback. You have to re-subscribe pretty much after every "Set" command you send. So, Subscribe really means more something like Get. (except for some things it's different - but mostly it's the same, except for certain times when it's completely different) The VoIP Dialer is also quirky. The two most strange things are the On/Off Hook feedback coming from the unit doesn't match reality quite often. Also, the Caller ID, for some reason, is considered the same kind of feedback as a volume level. when you subscribe to volume bar graph or Caller ID, you get reports of the status every 1 second, whether or not it has changed or not. To many of these status messages can bog traffic down pretty badly.
Now, AMX sales engineers are spec-ing the thing in large systems and I have to play along. AMX does have it working somewhat well within RPM. The volume control is still really flaky. But, it's functional. However, the just released AMX Duet module for us mere programmers (June 2017) was definitely a half-baked cookie and was essentially non-functional. While it sorta worked, it had several key flaws that killed it. I've been working on a project using it and the whole mess got so bad that AMX has escalated it to software engineering. I'm supposed to have a fix today sometime, or at least early next week. If so, that will help.
I've used the module I've written on 3 projects now and it seems pretty stable. I will say it is not what I'd call 'comprehensive' In other words, it doesn't do everything. It just does the basics of what I tend to do most. I have a true PASSTHRU and PASSBACK so I can send in raw commands when I need special things. (The AMX Duet modules PASSTHRU is stunningly bad. you should download it and look to se what I mean.)
I had hoped AMX would address the protocol but it's pretty clear now they have no intention of doing so. Perhaps it's too much to re-tool it or whatever. It's not that the protocol is insurmountable. But, when you think that there's several competitors out there with similar (if not better) products that are very easy to program and impliment, that AMX might have bought into a white elephant. (imagine that...)
I know my current client who's been having the problems that resulted in the AMX Escalation has sworn off the BSS altogether. They will finish out their current run of projects but have already started spec-ing Biamp. I wish I could say I felt bad about that. But, being on the receiving end of the whole BSS roll-out, I must admit I'm not.
Eric I thought last year you said they were going to do an overhaul on the protocol and make it more ascii based? Its all your fault!
Yeah - I haven't picked the winner of the world series in the past 5 years as well. I'm the 'Bad-Luck Schleprock" of AMX Programmers. I'm only reporting what they tell me. It was all just a pipe dream I guess.
The BSS documentation and samples provided clearly state you must do the checksum first, then escape the control characters.
The discussion threads here indicate the escaping of control characters must happen first, before doing the checksum.
Can one of you confirm for sure it's one way, or the other?
I'm doing checksum first, then replacing. Oh geez! Look at the time! It's 2017. Why the F are we doing F-ing checksums and hex?
Good. Every time a programmer masters communication with a BSS device, somewhere an ulcer is healed. That's the only reason I continue this.
And it's not at all swiping if I offer it freely. I'm just glad it helped you. We all have to work to keep each other up and floating. Otherwise we are just dragging everyone down.
I still hold on to a few trade secrets close to the vest though.
Good luck and happy coding.