summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js30
-rw-r--r--views/schematic.html13
-rw-r--r--views/script/form.js15
-rw-r--r--views/script/gui.js11
-rw-r--r--views/script/savenetlist.js19
-rw-r--r--views/style/schematic.css4
6 files changed, 63 insertions, 29 deletions
diff --git a/app.js b/app.js
index d437ead..b622606 100644
--- a/app.js
+++ b/app.js
@@ -21,8 +21,38 @@ require('./routes/routes.js')(express,app);
//Socket IO
var server = require('http').createServer(app);
var io = require('socket.io')(server);
+var fs = require('fs');
server.listen(app.get('port'),function(){
console.log('eSim Runing on port : '+app.get('port'));
+});
+
+io.on('connection',function(socket){
+ console.log('a user connected');
+ socket.on('disconnect', function(){
+ console.log('user disconnected');
+ fs.stat('/tmp/socket_id.cir.out', function(err, stat){
+ if(err == null){
+ fs.unlink('/tmp/socket_id.cir.out');
+ console.log('temp file deleted successfully');
+ }
+
+ });
+
+ });
+ socket.on('chat message', function(msg){
+ console.log('message: ' + msg);
+ });
+ socket.on('netlist', function(msg){
+ console.log('netlist stored in tmp folder')
+ fs.writeFile('/tmp/socket_id.cir.out', msg, function(err){
+ if(err){
+ return console.log(err);
+ }
+ });
+ });
+ io.emit('chat message', {hello: 'world'});
})
+
+
diff --git a/views/schematic.html b/views/schematic.html
index 4d8ef86..63e2476 100644
--- a/views/schematic.html
+++ b/views/schematic.html
@@ -18,6 +18,8 @@
<script type="text/javascript" src="script/rgbcolor.js"></script>
<script type="text/javascript" src="script/savenetlist.js"></script>
+
+
</head><body>
<div id="webtronics_main_window">
@@ -69,7 +71,13 @@ toolbar
<a href="http://esim.fossee.in/" target="_blank"><img src="icons/logo.png"/></a>
<br>
<a href="https://github.com/FOSSEE/eSimWebApp" target="_blank">Fossee</a>
-
+ <br>
+ <br>
+ <br>
+ <form id="websocket_form">
+ <input id="msgs">
+ <button id="send_to_server">Send</button>
+ </form>
</div>
<!--
@@ -547,5 +555,6 @@ simulation display
</div>
</div>
-
+<script src="/socket.io/socket.io.js"></script>
+<script type="text/javascript" src="script/form.js"></script>
</body></html>
diff --git a/views/script/form.js b/views/script/form.js
new file mode 100644
index 0000000..1d2bf2a
--- /dev/null
+++ b/views/script/form.js
@@ -0,0 +1,15 @@
+var socket = io();
+
+jQuery("#websocket_form").click(function(){
+ var msg = jQuery("#msgs").val();
+ if(msg!=''){
+ socket.emit('chat message', msg);
+ }
+ jQuery("#msgs").val('');
+ return false;
+ });
+
+socket.on('chat message', function(msg){
+ console.log(msg);
+});
+
diff --git a/views/script/gui.js b/views/script/gui.js
index e7325ae..4ba11b0 100644
--- a/views/script/gui.js
+++ b/views/script/gui.js
@@ -696,18 +696,13 @@ jQuery("#analysis_selectbox").change(function(){
change_val = "0";
Flag = "";
//console.log("out")
- console.log(globalVariable+" gv\n");
-
-console.log(globalVariable+" gv1\n");
-console.log(Flag+"1 s\n");
if (change_val == "0")
{
Flag = jQuery("#webtronics_netlist_text_area").val();
- console.log(Flag+"11s\n");
/*-------------------------------------------------------------------------------------------------------------------------------------
Here are the conditions concatenated to give final netlist values for dc all cases
---------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -742,14 +737,14 @@ Here are the all Transiet Cases for generating final netlist values
change_val = "1";
}
-console.log(Flag+"2\n");
+ socket.emit('netlist', jQuery("#webtronics_netlist_text_area").val());
}
else if( change_val == "1")
{
- console.log(Flag+"as\n");
+
jQuery("#webtronics_netlist_text_area").val("");
//console.log("if when 1")
@@ -778,7 +773,7 @@ else if( change_val == "1")
change_val = "1";
}
- console.log(Flag+"as\n");
+ socket.emit('netlist', jQuery("#webtronics_netlist_text_area").val());
}
diff --git a/views/script/savenetlist.js b/views/script/savenetlist.js
index 12e2cd1..bdabcfd 100644
--- a/views/script/savenetlist.js
+++ b/views/script/savenetlist.js
@@ -512,25 +512,6 @@ jQuery("#stop_time_selectbox").change(function(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*------------------------------------------------------------------------------------------------------------------------------------------------
-Netlist Generation
-----------------------*/
-
});
diff --git a/views/style/schematic.css b/views/style/schematic.css
index 1a3f93f..582ee1c 100644
--- a/views/style/schematic.css
+++ b/views/style/schematic.css
@@ -317,6 +317,10 @@ float:left;
}
+#msgs{
+ width: 85%;
+ height: 500%
+}
#webtronics_chip_display{
width:200px;