Subversion Repositories HomeAutomation

Rev

Rev 450 | Rev 457 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 450 Rev 453
Line 73... Line 73...
73
                Console.WriteLine("overflow ");
73
                Console.WriteLine("overflow ");
74
            }
74
            }
75
        }
75
        }
76
       
76
       
77
    }
77
    }
-
 
78
 
-
 
79
//  public CanPacket(byte pktclass, byte type, byte sid, byte rid, byte data_length, byte[] data) { 
-
 
80
//      //keep for compability for a while (Downloader.cs)
-
 
81
//      this.id = ((uint)pktclass<<24)|((uint)type<<16)|((uint)sid<<8)|((uint)rid);
-
 
82
//      this.data_length=data_length;
-
 
83
//      ext = 1;
-
 
84
//      rtr = 0;
-
 
85
//      for(int i=0;i<8;i++) this.data[i]=data[i];
-
 
86
//  }
78
   
87
   
79
//  public CanPacket(byte pktclass, byte type, byte sid, byte rid, byte data_length, byte[] data, byte rtr, byte ext) { 
88
//  public CanPacket(byte pktclass, byte type, byte sid, byte rid, byte data_length, byte[] data, byte rtr, byte ext) { 
80
//      this.pktclass=pktclass;
89
//      this.pktclass=pktclass;
81
//      this.type=type;
90
//      this.type=type;
82
//      this.sid=sid;
91
//      this.sid=sid;
Line 87... Line 96...
87
//      this.rtr = (byte)(0x0f & rtr);
96
//      this.rtr = (byte)(0x0f & rtr);
88
//  }
97
//  }
89
   
98
   
90
    public override int GetHashCode() {
99
    public override int GetHashCode() {
91
        return base.GetHashCode();
100
        return base.GetHashCode();
92
    }
101
    }
93
   
102
   
94
    public override bool  Equals(Object obj) {
103
    public override bool  Equals(Object obj) {
95
        CanPacket cpm = (CanPacket)obj;
104
        CanPacket cpm = (CanPacket)obj;
96
       
105
       
97
        byte[] bytes = cpm.getData();
106
        byte[] bytes = cpm.getData();
98
       
107
       
99
        for(int i=0;i<8;i++) if (this.data[i]!=bytes[i]) return false;
108
        for(int i=0;i<8;i++) if (this.data[i]!=bytes[i]) return false;
100
       
109
       
101
        return (this.id==cpm.getId() && this.data_length==cpm.getDataLength());
110
        return (this.id==cpm.getId() && this.data_length==cpm.getDataLength());
Line 110... Line 119...
110
//  public uint getRid(){ return this.sid; }
119
//  public uint getRid(){ return this.sid; }
111
    public void setDataLength(byte datalength){ this.data_length=datalength; }
120
    public void setDataLength(byte datalength){ this.data_length=datalength; }
112
    public byte getDataLength(){ return this.data_length; }
121
    public byte getDataLength(){ return this.data_length; }
113
    public byte[] getData(){ return this.data; }
122
    public byte[] getData(){ return this.data; }
114
    public void setExt(byte ext) { this.ext = ext; }
123
    public void setExt(byte ext) { this.ext = ext; }
-
 
124
 
-
 
125
    public void setData(byte[] data){ this.data = data; }
115
   
126
   
116
//  public override string ToString() {
127
//  public override string ToString() {
117
//      string str = "";
128
//      string str = "";
118
       
129
       
119
//      str = "pktclass: "+pktclass.ToString()+", type: "+type.ToString()+", sid: "+sid.ToString()+", rid: "+rid.ToString()+",data_length: "+data_length.ToString()+", data: ";
130
//      str = "pktclass: "+pktclass.ToString()+", type: "+type.ToString()+", sid: "+sid.ToString()+", rid: "+rid.ToString()+",data_length: "+data_length.ToString()+", data: ";