1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
|
implementation
{$R *.dfm}
procedure TForm1.add1Click(Sender: TObject);
var
DataStr: string;
ListBox: array[0..12] of integer;
SB : String;
counter : integer;
permut : integer;
buffer : integer;
begin
if Length(Heure1.text) < 2 then Heure1.text := '0'+Heure1.text;
if Length(Minutes1.text) < 2 then Minutes1.text := '0'+Minutes1.text;
if Length(type1.text) < 2 then type1.text := '0'+type1.text;
if Length(duree1.text) < 2 then duree1.text := '0'+duree1.text;
if Length(Heure1.text) < 2 then Heure1.text := '0'+Heure1.text;
if Length(Minutes1.text) < 2 then Minutes1.text := '0'+Minutes1.text;
if Length(type1.text) < 2 then type1.text := '0'+type1.text;
if Length(duree1.text) < 2 then duree1.text := '0'+duree1.text;
if StrToInt(Heure1.Text) > 23 then Heure1.Text := '00';
if StrToInt(Minutes1.Text) > 59 then Minutes1.Text := '00';
if StrToInt(Type1.Text) > 7 then Type1.Text := '00';
if StrToInt(Duree1.Text) > 31 then Duree1.Text := '00';
DataStr := Heure1.text+'h'+Minutes1.text+' --> type : '+type1.text+' Durée : '+duree1.text;
if listbox1.Items.Count <> 13 then
ListBox1.Items.Add(DataStr)
else
showmessage('Nombre de sonnerie maximum atteint pour cette zone');
with Listbox1 do
begin
if items.count>1 then
begin
for counter := 0 to items.count-1 do
//remplissage des donnée representative de l'heure
begin
SB := Items.strings[counter];
ListBox[counter] := StrToInt(SB[1]+SB[2])*100+StrToInt(SB[4]+SB[5]);
end;
//rangement par ordre croissant en fonction de l'heure
repeat
permut := 0;
for counter := 0 to items.count-2 do
begin
if ListBox[Counter]>ListBox[Counter+1] then
begin
//permuter les deux dans le tableau et la listbox
//tableau
Buffer := ListBox[Counter];
ListBox[Counter] := ListBox[Counter+1];
ListBox[Counter+1] :=Buffer;
//listbox
SB := Items.Strings[Counter];
Items.Strings[Counter] := Items.Strings[Counter+1];
Items.Strings[Counter+1] :=SB;
permut := 1;
end;
end;
until Permut = 0;
end;
end;
end;
procedure TForm1.add2Click(Sender: TObject);
var
DataStr: string;
ListBox: array[0..12] of integer;
SB : String;
counter : integer;
permut : integer;
buffer : integer;
begin
//formatage correcte du texte (sur deux chiffre)
if Length(Heure2.text) < 2 then Heure2.text := '0'+Heure2.text;
if Length(Minutes2.text) < 2 then Minutes2.text := '0'+Minutes2.text;
if Length(type2.text) < 2 then type2.text := '0'+type2.text;
if Length(duree2.text) < 2 then duree2.text := '0'+duree2.text;
if Length(Heure2.text) < 2 then Heure2.text := '0'+Heure2.text;
if Length(Minutes2.text) < 2 then Minutes2.text := '0'+Minutes2.text;
if Length(type2.text) < 2 then type2.text := '0'+type2.text;
if Length(duree2.text) < 2 then duree2.text := '0'+duree2.text;
//donnée coherente (type 0 a 7, durée 0 a 31, heure 0 a 23, minute 0 a 59)
if StrToInt(Heure2.Text) > 23 then Heure2.Text := '00';
if StrToInt(Minutes2.Text) > 59 then Minutes2.Text := '00';
if StrToInt(Type2.Text) > 7 then Type2.Text := '00';
if StrToInt(Duree2.Text) > 31 then Duree2.Text := '00';
DataStr := Heure2.text+'h'+Minutes2.text+' --> type : '+type2.text+' Durée : '+duree2.text;
if listbox2.Items.Count <> 13 then
ListBox2.Items.Add(DataStr)
else
showmessage('Nombre de sonnerie maximum atteint pour cette zone');
with Listbox2 do
begin
if items.count>1 then
begin
for counter := 0 to items.count-1 do
//remplissage des donnée representative de l'heure
begin
SB := Items.strings[counter];
ListBox[counter] := StrToInt(SB[1]+SB[2])*100+StrToInt(SB[4]+SB[5]);
end;
//rangement par ordre croissant en fonction de l'heure
repeat
permut := 0;
for counter := 0 to items.count-2 do
begin
if ListBox[Counter]>ListBox[Counter+1] then
begin
//permuter les deux dans le tableau et la listbox
//tableau
Buffer := ListBox[Counter];
ListBox[Counter] := ListBox[Counter+1];
ListBox[Counter+1] :=Buffer;
//listbox
SB := Items.Strings[Counter];
Items.Strings[Counter] := Items.Strings[Counter+1];
Items.Strings[Counter+1] :=SB;
permut := 1;
end;
end;
until Permut = 0;
end;
end;
end;
procedure TForm1.add3Click(Sender: TObject);
var
DataStr: string;
ListBox: array[0..12] of integer;
SB : String;
counter : integer;
permut : integer;
buffer : integer;
begin
if Length(Heure3.text) < 2 then Heure3.text := '0'+Heure3.text;
if Length(Minutes3.text) < 2 then Minutes3.text := '0'+Minutes3.text;
if Length(type3.text) < 2 then type3.text := '0'+type3.text;
if Length(duree3.text) < 2 then duree3.text := '0'+duree3.text;
if Length(Heure3.text) < 2 then Heure3.text := '0'+Heure3.text;
if Length(Minutes3.text) < 2 then Minutes3.text := '0'+Minutes3.text;
if Length(type3.text) < 2 then type3.text := '0'+type3.text;
if Length(duree3.text) < 2 then duree3.text := '0'+duree3.text;
if StrToInt(Heure3.Text) > 23 then Heure3.Text := '00';
if StrToInt(Minutes3.Text) > 59 then Minutes3.Text := '00';
if StrToInt(Type3.Text) > 7 then Type3.Text := '00';
if StrToInt(Duree3.Text) > 31 then Duree3.Text := '00';
DataStr := Heure3.text+'h'+Minutes3.text+' --> type : '+type3.text+' Durée : '+duree3.text;
if listbox3.Items.Count <> 13 then
ListBox3.Items.Add(DataStr)
else
showmessage('Nombre de sonnerie maximum atteint pour cette zone');
with Listbox3 do
begin
if items.count>1 then
begin
for counter := 0 to items.count-1 do
//remplissage des donnée representative de l'heure
begin
SB := Items.strings[counter];
ListBox[counter] := StrToInt(SB[1]+SB[2])*100+StrToInt(SB[4]+SB[5]);
end;
//rangement par ordre croissant en fonction de l'heure
repeat
permut := 0;
for counter := 0 to items.count-2 do
begin
if ListBox[Counter]>ListBox[Counter+1] then
begin
//permuter les deux dans le tableau et la listbox
//tableau
Buffer := ListBox[Counter];
ListBox[Counter] := ListBox[Counter+1];
ListBox[Counter+1] :=Buffer;
//listbox
SB := Items.Strings[Counter];
Items.Strings[Counter] := Items.Strings[Counter+1];
Items.Strings[Counter+1] :=SB;
permut := 1;
end;
end;
until Permut = 0;
end;
end;
end;
procedure TForm1.add4Click(Sender: TObject);
var
DataStr: string;
ListBox: array[0..12] of integer;
SB : String;
counter : integer;
permut : integer;
buffer : integer;
begin
if Length(Heure4.text) < 2 then Heure4.text := '0'+Heure4.text;
if Length(Minutes4.text) < 2 then Minutes4.text := '0'+Minutes4.text;
if Length(type4.text) < 2 then type4.text := '0'+type4.text;
if Length(duree4.text) < 2 then duree4.text := '0'+duree4.text;
if Length(Heure4.text) < 2 then Heure4.text := '0'+Heure4.text;
if Length(Minutes4.text) < 2 then Minutes4.text := '0'+Minutes4.text;
if Length(type4.text) < 2 then type4.text := '0'+type4.text;
if Length(duree4.text) < 2 then duree4.text := '0'+duree4.text;
if StrToInt(Heure4.Text) > 23 then Heure4.Text := '00';
if StrToInt(Minutes4.Text) > 59 then Minutes4.Text := '00';
if StrToInt(Type4.Text) > 7 then Type4.Text := '00';
if StrToInt(Duree4.Text) > 31 then Duree4.Text := '00';
DataStr := Heure4.text+'h'+Minutes4.text+' --> type : '+type4.text+' Durée : '+duree4.text;
if listbox4.Items.Count <> 13 then
ListBox4.Items.Add(DataStr)
else
showmessage('Nombre de sonnerie maximum atteint pour cette zone');
//rangement de la listbox :
with Listbox4 do
begin
if items.count>1 then
begin
for counter := 0 to items.count-1 do
//remplissage des donnée representative de l'heure
begin
SB := Items.strings[counter];
ListBox[counter] := StrToInt(SB[1]+SB[2])*100+StrToInt(SB[4]+SB[5]);
end;
//rangement par ordre croissant en fonction de l'heure
repeat
permut := 0;
for counter := 0 to items.count-2 do
begin
if ListBox[Counter]>ListBox[Counter+1] then
begin
//permuter les deux dans le tableau et la listbox
//tableau
Buffer := ListBox[Counter];
ListBox[Counter] := ListBox[Counter+1];
ListBox[Counter+1] :=Buffer;
//listbox
SB := Items.Strings[Counter];
Items.Strings[Counter] := Items.Strings[Counter+1];
Items.Strings[Counter+1] :=SB;
permut := 1;
end;
end;
until Permut = 0;
end;
end;
end;
procedure TForm1.sup1Click(Sender: TObject);
var
ii : integer;
begin
with ListBox1 do
begin
for ii := -1 + Items.Count downto 0 do
if Selected[ii] then Items.Delete(ii) ;
end;
end;
procedure TForm1.sup2Click(Sender: TObject);
var
ii : integer;
begin
with ListBox2 do
begin
for ii := -1 + Items.Count downto 0 do
if Selected[ii] then Items.Delete(ii) ;
end;
end;
procedure TForm1.sup3Click(Sender: TObject);
var
ii : integer;
begin
with ListBox3 do
begin
for ii := -1 + Items.Count downto 0 do
if Selected[ii] then Items.Delete(ii) ;
end;
end;
procedure TForm1.sup4Click(Sender: TObject);
var
ii : integer;
begin
with ListBox4 do
begin
for ii := -1 + Items.Count downto 0 do
if Selected[ii] then Items.Delete(ii) ;
end;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
ComPort1.Connected := true;
ListBox5.Items.Add('(UTC +00h00) [GMT, WET ~Eur. occidentale] Londres, Lisbonne, Casablanca');
ListBox5.Items.Add('(UTC +01h00) [CET ~Eur. centrale] Paris, Bruxelles, Berlin, Rome, Madrid');
ListBox5.Items.Add('(UTC +02h00) [EET ~Eur. orientale] Brazzaville, Athènes, Le Caire, Tel-Aviv');
ListBox5.Items.Add('(UTC +03h00) [MSK, BT] Riyad, Moscou, Volgograd, Bagdad, Nairobi');
ListBox5.Items.Add('(UTC +04h00) Abu Dhabi, Muscat, Bakou, Tbilissi, Erevan');
ListBox5.Items.Add('(UTC +05h00) Iekaterinburg, Islamabad, Karachi, Tachkent');
ListBox5.Items.Add('(UTC +06h00) Almaty, Dhaka, Colombo, Astana');
ListBox5.Items.Add('(UTC +07h00) Bangkok, Hanoi, Jakarta');
ListBox5.Items.Add('(UTC +08h00) [AWST] Pékin, Perth, Singapour, Hong Kong, Taipei');
ListBox5.Items.Add('(UTC +09h00) [JST, KST] Tokyo, Séoul, Osaka, Sapporo, Yakutsk');
ListBox5.Items.Add('(UTC +10h00) [AEST] Guam, Port Moresby, Vladivostok');
ListBox5.Items.Add('(UTC +11h00) Magadan, Îles Salomon, Nouvelle-Calédonie');
ListBox5.Items.Add('(UTC +12h00) [NZST] Auckland, Wellington, Fidji, Kamtchatka, Îles Marshall');
ListBox5.Items.Add('(UTC -01h00) Açores, Cap-Vert');
ListBox5.Items.Add('(UTC -02h00) [~Centre-Atlantique]');
ListBox5.Items.Add('(UTC -03h00) Brasilia, Buenos Aires, Georgetown, Groenland');
ListBox5.Items.Add('(UTC -04h00) [AST, HNA ~Atlantique] Caracas, La Paz, Santiago');
ListBox5.Items.Add('(UTC -05h00) [EST, HNE ~Est] Washington, Bogota, Lima, Quito');
ListBox5.Items.Add('(UTC -06h00) [CST, HNC ~Centre] Mexico');
ListBox5.Items.Add('(UTC -07h00) [MST, HNR ~Rocheuses] Phoenix');
ListBox5.Items.Add('(UTC -08h00) [PST, HNP ~Pacifique] Los Angeles');
ListBox5.Items.Add('(UTC -09h00) [YST, HNY ~Alaska]');
ListBox5.Items.Add('(UTC -10h00) [HST ~Hawaii] Honolulu');
ListBox5.Items.Add('(UTC -11h00) Îles Midway, Samoa');
ListBox5.Items.Add('(UTC -12h00) [IDLW] Eniwetok, Kwajalein');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ComPort1.Connected := false;
end;
procedure TForm1.progClick(Sender: TObject);
var
ACK : string;
StringBuffer: string;
Zone1Heure : Array[0..12] of integer;
Zone1Minutes : Array[0..12] of integer;
Zone1Data : Array[0..12] of integer;
Zone2Heure : Array[0..12] of integer;
Zone2Minutes : Array[0..12] of integer;
Zone2Data : Array[0..12] of integer;
Zone3Heure : Array[0..12] of integer;
Zone3Minutes : Array[0..12] of integer;
Zone3Data : Array[0..12] of integer;
Zone4Heure : Array[0..12] of integer;
Zone4Minutes : Array[0..12] of integer;
Zone4Data : Array[0..12] of integer;
TemporalCorrection : integer;
buffer : integer;
counter : integer;
begin
//mise en forme heure zone 1
for counter :=0 to listbox1.Items.Count-1 do
begin
StringBuffer := ListBox1.Items.strings[counter];
StringBuffer := StringBuffer[1]+StringBuffer[2];
Zone1Heure[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto listbox1.Items.Count do
begin
Zone1Heure[counter] := 0;
end;
//mise en forme Minutes zone 1
for counter :=0 to listbox1.Items.Count-1 do
begin
StringBuffer := ListBox1.Items.strings[counter];
StringBuffer := StringBuffer[4]+StringBuffer[5];
Zone1Minutes[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto listbox1.Items.Count do
begin
Zone1Minutes[counter] := 0;
end;
//donnée
//mise en forme Data zone 1
for counter :=0 to listbox1.Items.Count-1 do
begin
StringBuffer := ListBox1.Items.strings[counter];
StringBuffer := StringBuffer[18]+StringBuffer[19];
Buffer := StrToInt(StringBuffer) shl 5;
StringBuffer := ListBox1.Items.strings[counter];
StringBuffer := StringBuffer[29]+StringBuffer[30];
Buffer := Buffer+StrToInt(StringBuffer);
Zone1Data[counter] := Buffer;
end;
for counter :=12 downto listbox1.Items.Count do
begin
Zone1Data[counter] := 0;
end;
//mise en forme heure zone 2
for counter :=0 to ListBox2.Items.Count-1 do
begin
StringBuffer := ListBox2.Items.strings[counter];
StringBuffer := StringBuffer[1]+StringBuffer[2];
Zone2Heure[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto ListBox2.Items.Count do
begin
Zone2Heure[counter] := 0;
end;
//mise en forme Minutes zone 2
for counter :=0 to ListBox2.Items.Count-1 do
begin
StringBuffer := ListBox2.Items.strings[counter];
StringBuffer := StringBuffer[4]+StringBuffer[5];
Zone2Minutes[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto ListBox2.Items.Count do
begin
Zone2Minutes[counter] := 0;
end;
//donnée
//mise en forme Data zone 2
for counter :=0 to ListBox2.Items.Count-1 do
begin
StringBuffer := ListBox2.Items.strings[counter];
StringBuffer := StringBuffer[18]+StringBuffer[19];
Buffer := StrToInt(StringBuffer) shl 5;
StringBuffer := ListBox2.Items.strings[counter];
StringBuffer := StringBuffer[29]+StringBuffer[30];
Buffer := Buffer+StrToInt(StringBuffer);
Zone2Data[counter] := Buffer;
end;
for counter :=12 downto ListBox2.Items.Count do
begin
Zone2Data[counter] := 0;
end;
//mise en forme heure zone 3
for counter :=0 to ListBox3.Items.Count-1 do
begin
StringBuffer := ListBox3.Items.strings[counter];
StringBuffer := StringBuffer[1]+StringBuffer[2];
Zone3Heure[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto ListBox3.Items.Count do
begin
Zone3Heure[counter] := 0;
end;
//mise en forme Minutes zone 3
for counter :=0 to ListBox3.Items.Count-1 do
begin
StringBuffer := ListBox3.Items.strings[counter];
StringBuffer := StringBuffer[4]+StringBuffer[5];
Zone3Minutes[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto ListBox3.Items.Count do
begin
Zone3Minutes[counter] := 0;
end;
//donnée
//mise en forme Data zone 3
for counter :=0 to ListBox3.Items.Count-1 do
begin
StringBuffer := ListBox3.Items.strings[counter];
StringBuffer := StringBuffer[18]+StringBuffer[19];
Buffer := StrToInt(StringBuffer) shl 5;
StringBuffer := ListBox3.Items.strings[counter];
StringBuffer := StringBuffer[29]+StringBuffer[30];
Buffer := Buffer+StrToInt(StringBuffer);
Zone3Data[counter] := Buffer;
end;
for counter :=12 downto ListBox3.Items.Count do
begin
Zone3Data[counter] := 0;
end;
//mise en forme heure zone 4
for counter :=0 to ListBox4.Items.Count-1 do
begin
StringBuffer := ListBox4.Items.strings[counter];
StringBuffer := StringBuffer[1]+StringBuffer[2];
Zone4Heure[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto ListBox4.Items.Count do
begin
Zone4Heure[counter] := 0;
end;
//mise en forme Minutes zone 4
for counter :=0 to ListBox4.Items.Count-1 do
begin
StringBuffer := ListBox4.Items.strings[counter];
StringBuffer := StringBuffer[4]+StringBuffer[5];
Zone4Minutes[counter] := StrtoInt(StringBuffer);
end;
for counter :=12 downto ListBox4.Items.Count do
begin
Zone4Minutes[counter] := 0;
end;
//donnée
//mise en forme Data zone 4
for counter :=0 to ListBox4.Items.Count-1 do
begin
StringBuffer := ListBox4.Items.strings[counter];
StringBuffer := StringBuffer[18]+StringBuffer[19];
Buffer := StrToInt(StringBuffer) shl 5;
StringBuffer := ListBox4.Items.strings[counter];
StringBuffer := StringBuffer[29]+StringBuffer[30];
Buffer := Buffer+StrToInt(StringBuffer);
Zone4Data[counter] := Buffer;
end;
for counter :=12 downto ListBox4.Items.Count do
begin
Zone4Data[counter] := 0;
end;
//mise en forme des data du jet lag
with ListBox5 do
begin
for counter := -1 + Items.Count downto 0 do
if Selected[counter] then TemporalCorrection := counter ;
if temporalcorrection > 25 then temporalcorrection := 0;
end;
if comport1.Connected = true then ComPort1.writeStr('$');
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
if comport1.Connected = true then ComPort1.writeStr('P');
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
//envoie zone 1
//showmessage('meft');
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone1Heure[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
Progressbar1.Position := Progressbar1.Position + 1;
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone1Minutes[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
Progressbar1.Position := Progressbar1.Position + 1;
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone1Data[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
Progressbar1.Position := Progressbar1.Position + 1;
end;
//envoie zone 2
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone2Heure[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
Progressbar1.Position := Progressbar1.Position + 1;
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone2Minutes[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone2Data[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
//envoie Zone 3
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone3Heure[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone3Minutes[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone3Data[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
//envoie Zone 4
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone4Heure[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone4Minutes[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
for counter :=0 to 12 do
begin
if comport1.Connected = true then ComPort1.write(Zone4Data[counter],1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
end;
if comport1.Connected = true then ComPort1.write(TemporalCorrection,1);
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
Progressbar1.Position := Progressbar1.Position + 1;
ComPort1.ReadStr(ACK, 1);
if comport1.Connected = true then ComPort1.writeStr('*');
Comport1.Timeouts.ReadTotalConstant := 5000;
comport1.ClearBuffer(true,false);
ComPort1.ReadStr(ACK, 1);
Progressbar1.Position := 0;
//if ComPort1.Connected = true then Comport1.WriteStr('$');
//Comport1.Timeouts.ReadTotalConstant := 5000;
//comport1.ClearBuffer(true,false);
//ComPort1.ReadStr(ACK, 1);
//if ACK[1] = 'l' then
//showmessage('bien reçu')
//else
//showmessage('rien');
//showmessage(ACK);
//mettre en forme les donnée (recuperer dans les listbox les données)
//envoyer un $ a l'horloge
//attendre l'accusé de reception ('!') pendant 10 seconde et l'afficher
//envoyer 'p' pour programmation
//attendre l'accusé de reception
//envoyer les zone 1,2,3,4 puis la correction temporele et le checksum
//checksum = Xor de tout les cara, calculé en temps reel lors de l'emmission
//apres l'envoie du cheksum l'horloge renvoie le checksum comme accusé de reception
//si le checksum est bon on quitte en affichant programation reussi
//sinon on recommance
//envoie une etoile avant le chexksum
end;
end; |
Partager