@zimo-elektronik/zcan 1.0.51 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,7 @@ import {Buffer} from 'buffer';
2
2
  import MX10 from '../MX10';
3
3
  import {Subject} from 'rxjs';
4
4
  import {Query} from '../common/communication';
5
- import {BidiInfoData, BidiDirectionData} from '../common/models';
6
- import {BidiType, Direction, ForwardOrReverse, ModInfoType, MsgMode} from '../common/enums';
5
+ import {ModInfoType, MsgMode} from '../common/enums';
7
6
  import {MsgBidiInfo, MsgModInfo} from './infoMsg';
8
7
 
9
8
  /**
@@ -111,41 +110,30 @@ export default class InfoGroup
111
110
  const type = buffer.readUInt16LE(2);
112
111
  const info = buffer.readUInt32LE(4);
113
112
 
114
- let data: BidiDirectionData | number = {};
115
- switch (type) {
116
- case BidiType.DIRECTION:
117
- data.direction = this.parseEastWest(info);
118
- data.directionChange = this.parseDirChange(info);
119
- data.directionConfirm = this.parseDirectionConfirm(info);
120
- data.forwardOrReverse = this.parseFwdRev(info);
121
- break;
122
- default:
123
- data = info;
124
- }
125
113
  const msg = new MsgBidiInfo(MsgBidiInfo.header(mode, NID), type, undefined, info);
126
114
  this.onBidiInfoChange.next(msg);
127
115
  }
128
116
 
129
- private parseEastWest(data: number)
130
- {
131
- if ((data & 0x02) == 0x02)
132
- return Direction.EAST;
133
- return Direction.WEST;
134
- }
117
+ // private parseEastWest(data: number)
118
+ // {
119
+ // if ((data & 0x02) == 0x02)
120
+ // return Direction.EAST;
121
+ // return Direction.WEST;
122
+ // }
135
123
 
136
- private parseDirChange(data: number)
137
- {
138
- return (data & 0x04) == 0x04;
139
- }
124
+ // private parseDirChange(data: number)
125
+ // {
126
+ // return (data & 0x04) == 0x04;
127
+ // }
140
128
 
141
- private parseFwdRev(data: number)
142
- {
143
- if ((data & 0x01) == 0)
144
- return ForwardOrReverse.REVERSE;
145
- return ForwardOrReverse.FORWARD;
146
- }
147
- private parseDirectionConfirm(data: number)
148
- {
149
- return (data & 0x08) == 0x08;
150
- }
129
+ // private parseFwdRev(data: number)
130
+ // {
131
+ // if ((data & 0x01) == 0)
132
+ // return ForwardOrReverse.REVERSE;
133
+ // return ForwardOrReverse.FORWARD;
134
+ // }
135
+ // private parseDirectionConfirm(data: number)
136
+ // {
137
+ // return (data & 0x08) == 0x08;
138
+ // }
151
139
  }
@@ -40,4 +40,24 @@ export class MsgBidiInfo extends Message
40
40
  nid(): number {return this.header.mode === MsgMode.REQ ? this.data[0].value as number : this.header.nid || 0}
41
41
  type(): number {return this.data[this.header.mode === MsgMode.REQ ? 1 : 0].value as number}
42
42
  info(): number | undefined {return this.data.length > 1 ? this.data[1].value as number : undefined}
43
+
44
+ public static dirEast(info: number)
45
+ {
46
+ return ((info & 0x02) == 0x02)
47
+ }
48
+
49
+ public static dirChanging(info: number)
50
+ {
51
+ return ((info & 0x04) == 0x04)
52
+ }
53
+
54
+ public static dirForward(info: number)
55
+ {
56
+ return ((info & 0x01) == 0x01)
57
+ }
58
+
59
+ public static dirConfirm(info: number)
60
+ {
61
+ return ((info & 0x08) == 0x08)
62
+ }
43
63
  }