Skip to content

Commit 3ab5bf4

Browse files
committed
Issue 571 - removed all BP Client related code.
1 parent d1de841 commit 3ab5bf4

File tree

5 files changed

+1
-311
lines changed

5 files changed

+1
-311
lines changed

src/modules/blocklyc.js

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -284,83 +284,6 @@ export const loadInto = async (
284284
}
285285
})();
286286
}
287-
// else {
288-
// // Send the compile submission via an HTTP post
289-
// if (clientService.version.isCoded) {
290-
// // Request load with options from BlocklyProp Client
291-
// $.post(clientService.url('load.action'), {
292-
// 'option': loadOption,
293-
// 'action': loadAction,
294-
// 'binary': data.binary,
295-
// 'extension': data.extension,
296-
// 'comport': getComPort(),
297-
// }, function(loadData) {
298-
// // Callback to report results from client/launcher command
299-
// logConsoleMessage(
300-
// `(LOAI) Processing compiler results from server: ` +
301-
// `${loadData.message}`);
302-
// // Replace response message's consecutive white space with a
303-
// // new-line, then split at new lines
304-
// const message =
305-
// loadData.message.replace(/\s{2,}/g, '\n').split('\n');
306-
// // If responses have codes, check for all success codes (< 100)
307-
// let success = true;
308-
// const coded =
309-
// (loadOption === 'CODE' || loadOption === 'CODE_VERBOSE');
310-
// if (coded) {
311-
// message.forEach(function(x) {
312-
// success = success && x.substr(0, 3) < 100;
313-
// });
314-
// }
315-
// // Display results
316-
// let result;
317-
// if (success && coded) {
318-
// // Success! Keep it simple
319-
// result = ' Succeeded.';
320-
// } else {
321-
// // Failed (or not coded); Show the details
322-
// const error = [];
323-
// message.forEach(function(x) {
324-
// error.push(x.substr((coded) ? 4 : 0));
325-
// });
326-
// result = ((coded) ? ' Failed!' : '') +
327-
// '\n\n-------- loader messages --------\n' + error.join('\n');
328-
// }
329-
//
330-
// $('#compile-console').val($('#compile-console').val() + result);
331-
//
332-
// // Scroll automatically to the bottom after new data is added
333-
// document.getElementById('compile-console').scrollTop =
334-
// document.getElementById('compile-console').scrollHeight;
335-
// if (terminalNeeded === 'term' && loadData.success) {
336-
// serialConsole();
337-
// } else if (terminalNeeded === 'graph' && loadData.success) {
338-
// graphingConsole();
339-
// }
340-
// });// end of .post()
341-
// } else {
342-
// // TODO: Remove this once client_min_version is >= minCodedVer
343-
// // Request load without options from old BlocklyProp Client
344-
// $.post(clientService.url('load.action'), {
345-
// 'action': loadAction,
346-
// 'binary': data.binary,
347-
// 'extension': data.extension,
348-
// 'comport': getComPort(),
349-
// }, function(loadData) {
350-
// $('#compile-console').val($('#compile-console').val() +
351-
// loadData.message);
352-
//
353-
// // Scroll automatically to the bottom after new data is added
354-
// document.getElementById('compile-console').scrollTop =
355-
// document.getElementById('compile-console').scrollHeight;
356-
// if (terminalNeeded === 'term' && loadData.success) {
357-
// serialConsole();
358-
// } else if (terminalNeeded === 'graph' && loadData.success) {
359-
// graphingConsole();
360-
// }
361-
// });
362-
// }
363-
// }
364287
});
365288
} catch (e) {
366289
logConsoleMessage(`Catching : ${e.message}`);
@@ -433,56 +356,6 @@ export function graphingConsole() {
433356
graph.update(graph_data, graph_options);
434357
}
435358

436-
// if (clientService.type === serviceConnectionTypes.HTTP &&
437-
// clientService.portsAvailable) {
438-
// // Container and flag needed to receive and parse initial connection
439-
// // string before serial data begins streaming in.
440-
// let connString = '';
441-
// let connStrYet = false;
442-
// const connection = new WebSocket(
443-
// clientService.url('serial.connect', 'ws'));
444-
//
445-
// // When the connection is open, open com port
446-
// connection.onopen = function() {
447-
// const baudRate = clientService.terminalBaudRate > 0 ?
448-
// ` ${clientService.terminalBaudRate}`: '';
449-
// connection.send(`+++ open port ${getComPort()} ${baudRate}`);
450-
//
451-
// graphStartStop('start');
452-
// };
453-
//
454-
// // Log errors
455-
// connection.onerror = function(error) {
456-
// logConsoleMessage('WebSocket Error');
457-
// logConsoleMessage(error.message);
458-
// };
459-
//
460-
// connection.onmessage = function(e) {
461-
// const charBuffer = atob(e.data);
462-
// if (connStrYet) {
463-
// graphNewData(charBuffer);
464-
// } else {
465-
// connString += charBuffer;
466-
// if (connString.indexOf(
467-
// clientService.terminalBaudRate.toString(10)) > -1) {
468-
// connStrYet = true;
469-
// displayTerminalConnectionStatus(connString.trim());
470-
// } else {
471-
// graphNewData(charBuffer);
472-
// }
473-
// }
474-
// };
475-
//
476-
// $('#graphing-dialog').on('hidden.bs.modal', function() {
477-
// clientService.sendCharacterStreamTo = null;
478-
// connection.close();
479-
// graphStartStop('stop');
480-
// connString = '';
481-
// connStrYet = false;
482-
// displayTerminalConnectionStatus(null);
483-
// });
484-
// } else
485-
486359
if (clientService.type === serviceConnectionTypes.WS &&
487360
clientService.portsAvailable) {
488361
const messageToSend = {

src/modules/client_connection.js

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,6 @@ export const findClient = function() {
137137
propToolbarButtonController();
138138
}
139139
}
140-
141-
// BP-Launcher not found? Try connecting to the BP-Client
142-
// setTimeout(function() {
143-
// if (clientService.type !== serviceConnectionTypes.WS) {
144-
// logConsoleMessage('Trying to connect to the BP Client.');
145-
// establishBPClientConnection();
146-
// }
147-
// }, 1000);
148-
149-
// If connected to the BP-Client, poll for an updated port list
150-
// if (clientService.type === serviceConnectionTypes.HTTP) {
151-
// checkForComPorts();
152-
// }
153140
};
154141

155142
/**
@@ -509,45 +496,6 @@ function checkClientVersionModal(rawVersion) {
509496
}
510497
}
511498

512-
// /**
513-
// * Establish a connection to the BlocklyProp-Client (BPC) application
514-
// * Retrieves the BPC's version
515-
// * Sets parameters in the clientService object
516-
// * Calls UI configuration functions
517-
// * @deprecated
518-
// */
519-
// function establishBPClientConnection() {
520-
// logConsoleMessage('establishBPConnection: entry');
521-
// // Load data from the server using a HTTP GET request.
522-
// $.get(clientService.url(), function(/* @type BPClientDataBlock */ data) {
523-
// // {version: 0.7, version_str: "0.7.5", server: "BlocklyPropHTTP"}
524-
// logConsoleMessage(`Connected to client?: ${data.version_str}`);
525-
// if (!clientService.available) {
526-
// let clientVersionString = (typeof data.version_str !== 'undefined') ?
527-
// data.version_str : data.version;
528-
// logConsoleMessage(`Client version is: ${clientVersionString}`);
529-
//
530-
// if (!data.server || data.server !== 'BlocklyPropHTTP') {
531-
// clientVersionString = '0.0.0';
532-
// }
533-
// checkClientVersionModal(clientVersionString);
534-
// clientService.type = serviceConnectionTypes.HTTP;
535-
// // Connected to the Launcher/Client
536-
// clientService.available = true;
537-
// }
538-
// }).fail(function() {
539-
// logConsoleMessage('Failed to open client connection');
540-
// clientService.type = serviceConnectionTypes.NONE;
541-
// // Not connected to the Launcher/Client
542-
// clientService.available = false;
543-
// clientService.portsAvailable = false;
544-
// }).always( function() {
545-
// // Update the toolbar no mater what happens
546-
// logConsoleMessage('Updating toolbar');
547-
// propToolbarButtonController();
548-
// });
549-
// };
550-
551499
/**
552500
* Clear the com port drop-down
553501
*
@@ -606,29 +554,6 @@ function addComPortDeviceOption(port) {
606554
}
607555
}
608556

609-
// /**
610-
// * Update the list of serial ports available on the host machine
611-
// * NOTE: This function is used by the BP-Client only.
612-
// * @deprecated
613-
// */
614-
// const checkForComPorts = function() {
615-
// try {
616-
// if (clientService.type === serviceConnectionTypes.HTTP) {
617-
// $.get(clientService.url('ports.json'), function(data) {
618-
// logConsoleMessage('Getting a port list');
619-
// setPortListUI(data);
620-
// }).fail(function() {
621-
// setPortListUI(null);
622-
// }).always(function(data) {
623-
// logConsoleMessage(`The data is: ${data}`);
624-
// });
625-
// }
626-
// } catch (e) {
627-
// logConsoleMessage('Unable to get port list. ' + e.message);
628-
// setPortListUI(null);
629-
// }
630-
// };
631-
632557
/**
633558
* Return the selected com port name
634559
*

src/modules/client_service.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,6 @@ export const clientService = {
513513
this.getNumeric(rawVersion) >=
514514
this.getNumeric(this.RECOMMENDED)
515515
);
516-
// // remove after MINIMUM_ALLOWED is greater
517-
// this.isCoded = (
518-
// this.getNumeric(rawVersion) >=
519-
// this.getNumeric(this.CODED_MINIMUM)
520-
// );
521516
},
522517
},
523518

src/modules/editor.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,26 +2116,6 @@ const formatWizard = function() {
21162116
codePropC.gotoLine(currentLine);
21172117
};
21182118

2119-
// /**
2120-
// * Pretty formatter for C code
2121-
// *
2122-
// * @param {string} rawCode
2123-
// * @return {string}
2124-
// */
2125-
// export const prettyCode = function(rawCode) {
2126-
// // TODO: The jsBeautifier package is NOT targeted to C source code. Replace
2127-
// // this functionality with something that understands C source code.
2128-
// // improve the way functions and arrays are rendered
2129-
// rawCode = rawCode.replace(/\)\s*[\n\r]\s*{/g, ') {')
2130-
// .replace(/\[([0-9]*)\]\s*=\s*{\s*([0-9xXbBA-F,\s]*)\s*};/g,
2131-
// function(str, m1, m2) {
2132-
// m2 = m2.replace(/\s/g, '').replace(/,/g, ', ');
2133-
// return '[' + m1 + '] = {' + m2 + '};';
2134-
// });
2135-
//
2136-
// return rawCode;
2137-
// };
2138-
21392119
/**
21402120
* Save a project to the local file system
21412121
*/

src/modules/serial_console.js

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import Blockly from 'blockly/core';
2424

2525
import {displayTerminalConnectionStatus} from './blocklyc';
26-
import {clientService, serviceConnectionTypes} from './client_service';
26+
import {clientService} from './client_service';
2727
import {logConsoleMessage} from './utility';
2828
import {getComPort} from './client_connection';
2929
import {getPropTerminal} from './prop_term';
@@ -46,88 +46,6 @@ let initDialogHandler = false;
4646
export function serialConsole() {
4747
clientService.sendCharacterStreamTo = 'term';
4848

49-
// // --------------------------------------------------------
50-
// // Process the serial console with the older BP HTTP client
51-
// // --------------------------------------------------------
52-
// if (clientService.type !== serviceConnectionTypes.WS) {
53-
// if (clientService.portsAvailable) {
54-
// // Container and flag needed to receive and parse initial connection
55-
// // string before serial data begins streaming in.
56-
// let connString = '';
57-
// let connStrYet = false;
58-
//
59-
// const connection = new WebSocket(
60-
// clientService.url('serial.connect', 'ws'));
61-
//
62-
// // When the connection is open, open com port
63-
// connection.onopen = function() {
64-
// connString = '';
65-
// connStrYet = false;
66-
// const baudRate = clientService.terminalBaudRate > 0 ?
67-
// ` ${clientService.terminalBaudRate}`: '';
68-
// connection.send(`+++ open port ${getComPort()} ${baudRate}`);
69-
// clientService.activeConnection = connection;
70-
// };
71-
//
72-
// // Log errors
73-
// connection.onerror = function(error) {
74-
// logConsoleMessage('WebSocket Error');
75-
// logConsoleMessage(error.message);
76-
// };
77-
//
78-
// // Receive characters
79-
// connection.onmessage = function(e) {
80-
// const pTerm = getPropTerminal();
81-
// // incoming data is base64 encoded
82-
// const charBuffer = atob(e.data);
83-
// if (connStrYet) {
84-
// pTerm.display(charBuffer);
85-
// } else {
86-
// connString += charBuffer;
87-
// if (connString.indexOf(
88-
// clientService.terminalBaudRate.toString(10)) > -1) {
89-
// connStrYet = true;
90-
// displayTerminalConnectionStatus(connString.trim());
91-
// } else {
92-
// pTerm.display(e.data);
93-
// }
94-
// }
95-
// pTerm.focus();
96-
// };
97-
//
98-
// // Set the event handler exactly once.
99-
// if (!initDialogHandler) {
100-
// initDialogHandler = true;
101-
//
102-
// $('#console-dialog').on('hidden.bs.modal', function() {
103-
// clientService.sendCharacterStreamTo = null;
104-
// logConsoleMessage(`Closing serial console WS connection`);
105-
// clientService.activeConnection = null;
106-
// connString = '';
107-
// connStrYet = false;
108-
// connection.close();
109-
// displayTerminalConnectionStatus(null);
110-
// getPropTerminal().display(null);
111-
// });
112-
// }
113-
// } else {
114-
// // Remove any previous connection
115-
// logConsoleMessage(`No ports available so closing the WS connection.`);
116-
// clientService.activeConnection = null;
117-
//
118-
// // Display a "No connected devices" message in the terminal
119-
// displayTerminalConnectionStatus(
120-
// Blockly.Msg.DIALOG_TERMINAL_NO_DEVICES_TO_CONNECT);
121-
// getPropTerminal().display(Blockly.Msg.DIALOG_TERMINAL_NO_DEVICES + '\n');
122-
//
123-
// // Clear the terminal if the user closes it.
124-
// $('#console-dialog').on('hidden.bs.modal', function() {
125-
// clientService.sendCharacterStreamTo = null;
126-
// displayTerminalConnectionStatus(null);
127-
// getPropTerminal().display(null);
128-
// });
129-
// }
130-
// } else if (clientService.type === serviceConnectionTypes.WS) {
13149
// --------------------------------------------------------------
13250
// Using Websocket-only client
13351
// --------------------------------------------------------------
@@ -171,7 +89,6 @@ export function serialConsole() {
17189
getPropTerminal().display(null);
17290
});
17391
}
174-
// }
17592

17693
// Open the Console window
17794
$('#console-dialog').modal('show');

0 commit comments

Comments
 (0)