Rev 1166 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1166 | Rev 1167 | ||
|---|---|---|---|
| Line 21... | Line 21... | ||
| 21 | { |
21 | { |
| 22 | this.CanService(type, name, id); |
22 | this.CanService(type, name, id); |
| 23 | this.myLastDirection = new Array(); |
23 | this.myLastDirection = new Array(); |
| 24 | this.myLastSteps = new Array(); |
24 | this.myLastSteps = new Array(); |
| 25 | this.myLastPosition = new Array(); |
25 | this.myLastPosition = new Array(); |
| - | 26 | this.myLastButtonStatus = new Array(); |
|
| 26 | } |
27 | } |
| 27 | 28 | ||
| 28 | extend(Rotary, CanService); |
29 | extend(Rotary, CanService); |
| 29 | 30 | ||
| 30 | Rotary.prototype.myLastDirection = null; |
31 | Rotary.prototype.myLastDirection = null; |
| Line 38... | Line 39... | ||
| 38 | if (canMessage.getDirectionFlag() == "From_Owner") |
39 | if (canMessage.getDirectionFlag() == "From_Owner") |
| 39 | { |
40 | { |
| 40 | switch (canMessage.getCommandName()) |
41 | switch (canMessage.getCommandName()) |
| 41 | { |
42 | { |
| 42 | case "Rotary_Switch": |
43 | case "Rotary_Switch": |
| 43 | log(this.myName + ":" + this.myId + "> New direction: " + canMessage.getData("Direction") + ", steps: " + canMessage.getData("Steps") + "\n"); |
44 | log(this.myName + ":" + this.myId + "> New direction: " + canMessage.getData("Direction") + ", steps: " + canMessage.getData("Steps") + ", position: " + canMessage.getData("Position") + "\n"); |
| 44 | this.myLastDirection[canMessage.getData("SwitchId")] = canMessage.getData("Direction"); |
45 | this.myLastDirection[canMessage.getData("SwitchId")] = canMessage.getData("Direction"); |
| 45 | this.myLastSteps[canMessage.getData("SwitchId")] = canMessage.getData("Steps"); |
46 | this.myLastSteps[canMessage.getData("SwitchId")] = canMessage.getData("Steps"); |
| 46 | this.myLastPosition[canMessage.getData("SwitchId")] = canMessage.getData("Position"); |
47 | this.myLastPosition[canMessage.getData("SwitchId")] = canMessage.getData("Position"); |
| 47 | this.callEvent(" |
48 | this.callEvent("newPosition", canMessage.getData("SwitchId")); |
| 48 | break; |
49 | break; |
| 49 | 50 | ||
| 50 | case "Button": |
51 | case "Button": |
| 51 | log(this.myName + ":" + this.myId + "> New button status: " + canMessage.getData("Status") + "\n"); |
52 | log(this.myName + ":" + this.myId + "> New button status: " + canMessage.getData("Status") + "\n"); |
| 52 | this.myLastButtonStatus[canMessage.getData("SwitchId")] = canMessage.getData("Status"); |
53 | this.myLastButtonStatus[canMessage.getData("SwitchId")] = canMessage.getData("Status"); |
| 53 | this.callEvent(" |
54 | this.callEvent("newBtnStatus", canMessage.getData("SwitchId")); |
| 54 | break; |
55 | break; |
| 55 | } |
56 | } |
| 56 | } |
57 | } |
| 57 | 58 | ||
| 58 | this.CanService.prototype.canMessageHandler.call(this, canMessage); |
59 | this.CanService.prototype.canMessageHandler.call(this, canMessage); |