Subversion Repositories HomeAutomation

Rev

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

Rev 1013 Rev 1014
Line 78... Line 78...
78
    }
78
    }
79
   
79
   
80
    this.myProgramming = true;
80
    this.myProgramming = true;
81
    this.myProgrammingHex = hexData;
81
    this.myProgrammingHex = hexData;
82
    this.myProgrammingCallback = progressCallback;
82
    this.myProgrammingCallback = progressCallback;
-
 
83
   
-
 
84
    CanProgrammingNode = this;
83
   
85
   
84
    this.reset();
86
    this.reset();
85
}
87
}
86
 
88
 
87
CanNode.prototype.handleBiosStart = function(biosVersion, hasApplication)
89
CanNode.prototype.handleBiosStart = function(biosVersion, hasApplication)
Line 103... Line 105...
103
}
105
}
104
 
106
 
105
CanNode.prototype.handleAck = function(data)
107
CanNode.prototype.handleAck = function(data)
106
{
108
{
107
this.myProgrammingCallback(true, "DBG", "data: "+data+", myProgrammingWantAck: "+this.myProgrammingWantAck+"\n");
109
this.myProgrammingCallback(true, "DBG", "data: "+data+", myProgrammingWantAck: "+this.myProgrammingWantAck+"\n");
108
   
110
   
109
//dont do this right now
111
//dont do this right now
110
    if (data == this.myProgrammingWantAck && false)
112
    if (data == this.myProgrammingWantAck && false)
111
    {
113
    {
112
       
114
       
113
        var type = ""; ///TODO: Fill in which type of data we have
115
        var type = ""; ///TODO: Fill in which type of data we have
114
       
116
       
115
        switch (type)
117
        switch (type)
116
        {
118
        {
117
        case "DATA":///TODO: Maybe it is called something else, maybe a number
119
        case "DATA":///TODO: Maybe it is called something else, maybe a number
118
            var offset = ""; ///TODO: Fill in something here
120
            var offset = ""; ///TODO: Fill in something here
119
            var data = ""; ///TODO: Fill in something here
121
            var data = ""; ///TODO: Fill in something here
120
       
122
       
121
            this.myProgrammingWantAck = "";  ///TODO: Fill in something here
123
            this.myProgrammingWantAck = "";  ///TODO: Fill in something here
122
       
124
       
123
            var canMessage = new CanNMTMessage("nmt", "Pgm_Data");
125
            var canMessage = new CanNMTMessage("nmt", "Pgm_Data");
124
            canMessage.setData("Offset", offset);
126
            canMessage.setData("Offset", offset);
125
            canMessage.setData("Data", data);
127
            canMessage.setData("Data", data);
126
            canMessage.send();
128
            canMessage.send();
127
           
129
           
128
            this.myProgrammingCallback(true, "PROGRESS", this.myProgrammingHexAddress + ":" + this.myProgrammingHex.length);
130
            this.myProgrammingCallback(true, "PROGRESS", this.myProgrammingHexAddress + ":" + this.myProgrammingHex.length);
129
            break;
131
            break;
130
       
132
       
131
        case "END":///TODO: Maybe it is called something else, maybe a number
133
        case "END":///TODO: Maybe it is called something else, maybe a number
132
            this.myProgrammingWantAck = "";  ///TODO: Fill in something here
134
            this.myProgrammingWantAck = "";  ///TODO: Fill in something here
133
       
135
       
134
            var canMessage = new CanNMTMessage("nmt", "Pgm_End");
136
            var canMessage = new CanNMTMessage("nmt", "Pgm_End");
135
            canMessage.send();
137
            canMessage.send();
136
           
138
           
137
            this.myProgrammingCallback(true, "END", ""); ///TODO: Fill in something meaningfull text
139
            this.myProgrammingCallback(true, "END", ""); ///TODO: Fill in something meaningfull text
Line 139... Line 141...
139
       
141
       
140
        case "COPY":///TODO: Maybe it is called something else, maybe a number
142
        case "COPY":///TODO: Maybe it is called something else, maybe a number
141
            var source = ""; ///TODO: Fill in something here
143
            var source = ""; ///TODO: Fill in something here
142
            var destination = ""; ///TODO: Fill in something here
144
            var destination = ""; ///TODO: Fill in something here
143
            var length = ""; ///TODO: Fill in something here
145
            var length = ""; ///TODO: Fill in something here
144
           
146
           
145
            this.myProgrammingWantAck = "";  ///TODO: Fill in something here
147
            this.myProgrammingWantAck = "";  ///TODO: Fill in something here
146
       
148
       
147
            var canMessage = new CanNMTMessage("nmt", "Pgm_Copy");
149
            var canMessage = new CanNMTMessage("nmt", "Pgm_Copy");
148
            canMessage.setData("Source", source);
150
            canMessage.setData("Source", source);
149
            canMessage.setData("Destination", destination);
151
            canMessage.setData("Destination", destination);
Line 176... Line 178...
176
    this.myProgramming = false;
178
    this.myProgramming = false;
177
    this.myProgrammingHex = new Array();
179
    this.myProgrammingHex = new Array();
178
    this.myProgrammingHexAddress = 0;
180
    this.myProgrammingHexAddress = 0;
179
    this.myProgrammingCallback = function() {};
181
    this.myProgrammingCallback = function() {};
180
    this.myProgrammingWantAck = null;
182
    this.myProgrammingWantAck = null;
-
 
183
   
-
 
184
    CanProgrammingNode = null;
181
}
185
}
182
 
186
 
183
 
187
 
184
 
188
 
185
CanNode.prototype.addService = function(sequenceNumber, service)
189
CanNode.prototype.addService = function(sequenceNumber, service)