Modification BDD : Saisie des valeurs de test pour le client virtuel (puces + pins + états)
This commit is contained in:
parent
46872d5d30
commit
159a77b0eb
|
@ -3,7 +3,7 @@
|
|||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Jul 19, 2016 at 12:39 AM
|
||||
-- Generation Time: Jul 19, 2016 at 10:51 AM
|
||||
-- Server version: 5.7.12-0ubuntu1.1
|
||||
-- PHP Version: 7.0.4-7ubuntu2.1
|
||||
|
||||
|
@ -99,9 +99,9 @@ CREATE TABLE `chip` (
|
|||
--
|
||||
|
||||
INSERT INTO `chip` (`id_chip`, `name`, `position`, `type`) VALUES
|
||||
(1, 'led1', 0, 'LED'),
|
||||
(2, 'relay1', 1, 'RELAY'),
|
||||
(3, 'relay2', 2, 'RELAI');
|
||||
(1, 'led1', 0, 'SERIAL'),
|
||||
(2, 'relay1', 1, 'SERIAL'),
|
||||
(3, 'relay2', 2, 'SERIAL');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -339,16 +339,27 @@ INSERT INTO `module_merge` (`id_warehouse`, `id_module`) VALUES
|
|||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `pin`
|
||||
-- Table structure for table `pin_merge`
|
||||
--
|
||||
|
||||
CREATE TABLE `pin` (
|
||||
CREATE TABLE `pin_merge` (
|
||||
`id_pin_merge` int(11) NOT NULL,
|
||||
`id_chip` int(11) NOT NULL,
|
||||
`pin` int(11) NOT NULL,
|
||||
`type` varchar(20) COLLATE utf8_unicode_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `pin_merge`
|
||||
--
|
||||
|
||||
INSERT INTO `pin_merge` (`id_pin_merge`, `id_chip`, `pin`, `type`) VALUES
|
||||
(1, 1, 1, 'LED_R'),
|
||||
(2, 1, 2, 'LED_G'),
|
||||
(3, 1, 3, 'LED_B'),
|
||||
(4, 2, 4, 'RELAY'),
|
||||
(5, 3, 5, 'RELAY');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
|
@ -358,9 +369,32 @@ CREATE TABLE `pin` (
|
|||
CREATE TABLE `state` (
|
||||
`id_state` int(11) NOT NULL,
|
||||
`id_pin_merge` int(11) NOT NULL,
|
||||
`value` varchar(1) COLLATE utf8_unicode_ci NOT NULL
|
||||
`state` varchar(1) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`value` smallint(4) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `state`
|
||||
--
|
||||
|
||||
INSERT INTO `state` (`id_state`, `id_pin_merge`, `state`, `value`) VALUES
|
||||
(1, 1, '0', 0),
|
||||
(2, 2, '0', 0),
|
||||
(3, 3, '0', 0),
|
||||
(4, 1, '1', 0),
|
||||
(5, 2, '1', 255),
|
||||
(6, 3, '1', 0),
|
||||
(7, 1, '2', 0),
|
||||
(8, 2, '2', 0),
|
||||
(9, 3, '2', 255),
|
||||
(10, 1, '3', 255),
|
||||
(11, 2, '3', 0),
|
||||
(12, 3, '3', 0),
|
||||
(13, 4, '0', 0),
|
||||
(14, 4, '1', 1),
|
||||
(15, 5, '0', 0),
|
||||
(16, 5, '1', 1);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
|
@ -629,9 +663,9 @@ ALTER TABLE `module_merge`
|
|||
ADD KEY `id_warehouse` (`id_warehouse`);
|
||||
|
||||
--
|
||||
-- Indexes for table `pin`
|
||||
-- Indexes for table `pin_merge`
|
||||
--
|
||||
ALTER TABLE `pin`
|
||||
ALTER TABLE `pin_merge`
|
||||
ADD PRIMARY KEY (`id_pin_merge`),
|
||||
ADD KEY `id_chip` (`id_chip`);
|
||||
|
||||
|
@ -725,15 +759,15 @@ ALTER TABLE `machine_cluster_merge`
|
|||
ALTER TABLE `module`
|
||||
MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `pin`
|
||||
-- AUTO_INCREMENT for table `pin_merge`
|
||||
--
|
||||
ALTER TABLE `pin`
|
||||
MODIFY `id_pin_merge` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `pin_merge`
|
||||
MODIFY `id_pin_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `state`
|
||||
--
|
||||
ALTER TABLE `state`
|
||||
MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT;
|
||||
MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `user`
|
||||
--
|
||||
|
@ -807,11 +841,17 @@ ALTER TABLE `module_merge`
|
|||
ADD CONSTRAINT `module_merge_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `pin`
|
||||
-- Constraints for table `pin_merge`
|
||||
--
|
||||
ALTER TABLE `pin`
|
||||
ALTER TABLE `pin_merge`
|
||||
ADD CONSTRAINT `pin_id_chip` FOREIGN KEY (`id_chip`) REFERENCES `chip` (`id_chip`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `state`
|
||||
--
|
||||
ALTER TABLE `state`
|
||||
ADD CONSTRAINT `state_id_pin_merge` FOREIGN KEY (`id_pin_merge`) REFERENCES `pin_merge` (`id_pin_merge`);
|
||||
|
||||
--
|
||||
-- Constraints for table `user`
|
||||
--
|
||||
|
|
|
@ -254,12 +254,16 @@
|
|||
var board = new Board(50);
|
||||
|
||||
var chip = {
|
||||
led: new LedInterface( new Chip(1, 2, 3), led ),
|
||||
r1: new RelayInterface( new Chip(4), r1 ),
|
||||
r2: new RelayInterface( new Chip(5), r2 )
|
||||
led: new LedInterface( new Chip('serial', [1, 2, 3]), led ),
|
||||
r1: new RelayInterface( new Chip('serial', [4]), r1 ),
|
||||
r2: new RelayInterface( new Chip('serial', [5]), r2 )
|
||||
};
|
||||
|
||||
board.plug( chip.led )
|
||||
var chipList = Object.keys(chip);
|
||||
|
||||
// Branchement des puces
|
||||
for( var i = 0 ; i < chipList.length ; i++ )
|
||||
board.plug( chip[chipList[i]] );
|
||||
|
||||
|
||||
/* [1] Fonctions
|
||||
|
|
|
@ -78,7 +78,7 @@ var Board;
|
|||
|
||||
/* [2] Branchement + on lie l'interface
|
||||
=========================================================*/
|
||||
for( var i = 0 ; i < chipInterface.chip.pins.length ; i++ ){
|
||||
for( i = 0 ; i < chipInterface.chip.pins.length ; i++ ){
|
||||
this.pins[i] = chipInterface.chip.values[i];
|
||||
this.listener[i] = chipInterface;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ var Chip;
|
|||
this.pins = pins;
|
||||
this.values = [];
|
||||
|
||||
for( var i = 0 ; i < this.pins.length ; i++ )
|
||||
for( i = 0 ; i < this.pins.length ; i++ )
|
||||
this.values[i] = new Pin(0);
|
||||
};
|
||||
|
||||
|
@ -336,10 +336,8 @@ var RelayInterface;
|
|||
*
|
||||
*/
|
||||
RelayInterface.prototype.update = function(){
|
||||
if( this.chip.pin[0] )
|
||||
this.container.addClass('active');
|
||||
else
|
||||
this.container.remClass('active');
|
||||
if( this.chip.pin[0] ) this.container.addClass('active');
|
||||
else this.container.remClass('active');
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue