|
|
@ -54,8 +54,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<div id="ssid-list"></div> |
|
|
<div id="ssid-list"></div> |
|
|
<button id="add-ssid" class="icon-button" title="SSID 추가">➕</button> |
|
|
<button id="add-ssid" class="icon-button" title="add SSID">➕</button> |
|
|
<button id="delete-ssid" class="icon-button" title="SSID 삭제">➖</button> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<div class="actions"> |
|
|
<div class="actions"> |
|
|
<div class="file-upload-wrapper-device" |
|
|
<div class="file-upload-wrapper-device" |
|
|
@ -66,7 +65,7 @@ |
|
|
<input type="file" class="upload-input-device" accept=".json" style="display: none;"> |
|
|
<input type="file" class="upload-input-device" accept=".json" style="display: none;"> |
|
|
<button class="select-file-btn-device">Load Local Device File</button> |
|
|
<button class="select-file-btn-device">Load Local Device File</button> |
|
|
</div> |
|
|
</div> |
|
|
<button class="download-device-file">Download Device File</button> |
|
|
<button class="download-device-file">Download Local Device File</button> |
|
|
</div> |
|
|
</div> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
@ -93,15 +92,15 @@ |
|
|
<h3>Server</h3> |
|
|
<h3>Server</h3> |
|
|
<div class="grid-3-col"><strong></strong><span style="text-align:center">IP</span><span |
|
|
<div class="grid-3-col"><strong></strong><span style="text-align:center">IP</span><span |
|
|
style="text-align:center">Port</span></div> |
|
|
style="text-align:center">Port</span></div> |
|
|
<div class="grid-3-col"><span>TIoT Server</span> <input id="protocol_server_ip"/><input |
|
|
<div class="grid-3-col"><span>TIoT Server</span> <input id="protocol_server_ip" placeholder="ex)123.123.123.123"/><input |
|
|
id="protocol_server_port"/></div> |
|
|
id="protocol_server_port"/></div> |
|
|
<div class="grid-3-col"><span>Update Server</span><input id="update_server_ip"/><input |
|
|
<div class="grid-3-col"><span>Update Server</span><input id="update_server_ip" placeholder="ex)123.123.123.123"/><input |
|
|
id="update_server_port"/></div> |
|
|
id="update_server_port"/></div> |
|
|
<div class="grid-3-col"><span>DGPS Server</span> <input id="rtcm_server_ip"/><input |
|
|
<div class="grid-3-col"><span>DGPS Server</span> <input id="rtcm_server_ip" placeholder="ex)123.123.123.123"/><input |
|
|
id="rtcm_server_port"/></div> |
|
|
id="rtcm_server_port"/></div> |
|
|
<div class="grid-3-col"><span>OPC-UA</span> <input id="opc_ua_server_ip"/><input |
|
|
<div class="grid-3-col"><span>OPC-UA</span> <input id="opc_ua_server_ip" placeholder="ex)123.123.123.123"/><input |
|
|
id="opc_ua_server_port"/></div> |
|
|
id="opc_ua_server_port"/></div> |
|
|
<div class="grid-3-col"><span>MODBUS</span> <input id="modbus_server_ip"/><input |
|
|
<div class="grid-3-col"><span>MODBUS</span> <input id="modbus_server_ip" placeholder="ex)123.123.123.123"/><input |
|
|
id="modbus_server_port"/></div> |
|
|
id="modbus_server_port"/></div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="actions"> |
|
|
<div class="actions"> |
|
|
@ -113,7 +112,7 @@ |
|
|
<input type="file" class="upload-input-device" accept=".json" style="display: none;"> |
|
|
<input type="file" class="upload-input-device" accept=".json" style="display: none;"> |
|
|
<button class="select-file-btn-device">Load Local Device File</button> |
|
|
<button class="select-file-btn-device">Load Local Device File</button> |
|
|
</div> |
|
|
</div> |
|
|
<button class="download-device-file">Download Device File</button> |
|
|
<button class="download-device-file">Download Local Device File</button> |
|
|
</div> |
|
|
</div> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
@ -140,12 +139,12 @@ |
|
|
<div class="io-fieldset"> |
|
|
<div class="io-fieldset"> |
|
|
<div class="io-row"><span class="label-inline">IP</span><span class="colon">:</span><input |
|
|
<div class="io-row"><span class="label-inline">IP</span><span class="colon">:</span><input |
|
|
id="lte_ip"></div> |
|
|
id="lte_ip"></div> |
|
|
|
|
|
<div class="io-row"><span class="label-inline">PORT</span><span class="colon">:</span><input |
|
|
|
|
|
id="lte_port"></div> |
|
|
<div class="io-row"><span class="label-inline">NETMASK</span><span |
|
|
<div class="io-row"><span class="label-inline">NETMASK</span><span |
|
|
class="colon">:</span><input id="lte_netmask"></div> |
|
|
class="colon">:</span><input id="lte_netmask"></div> |
|
|
<div class="io-row"><span class="label-inline">GATEWAY</span><span |
|
|
<div class="io-row"><span class="label-inline">GATEWAY</span><span |
|
|
class="colon">:</span><input id="lte_gateway"></div> |
|
|
class="colon">:</span><input id="lte_gateway"></div> |
|
|
<div class="io-row"><span class="label-inline">PORT</span><span class="colon">:</span><input |
|
|
|
|
|
id="lte_port"></div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -245,7 +244,7 @@ |
|
|
<input type="file" class="upload-input-device" accept=".json" style="display: none;"> |
|
|
<input type="file" class="upload-input-device" accept=".json" style="display: none;"> |
|
|
<button class="select-file-btn-device">Load Local Device File</button> |
|
|
<button class="select-file-btn-device">Load Local Device File</button> |
|
|
</div> |
|
|
</div> |
|
|
<button class="download-device-file">Download Device File</button> |
|
|
<button class="download-device-file">Download Local Device File</button> |
|
|
</div> |
|
|
</div> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
@ -394,7 +393,7 @@ |
|
|
<input type="file" class="upload-input-protocol" accept=".json" style="display: none;"> |
|
|
<input type="file" class="upload-input-protocol" accept=".json" style="display: none;"> |
|
|
<button class="select-file-btn-protocol">Load Local Protocol File</button> |
|
|
<button class="select-file-btn-protocol">Load Local Protocol File</button> |
|
|
</div> |
|
|
</div> |
|
|
<button class="download-protocol-file">Download Device File</button> |
|
|
<button class="download-protocol-file">Download Local Protocol File</button> |
|
|
</div> |
|
|
</div> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
@ -482,7 +481,7 @@ |
|
|
<input type="file" class="upload-input-protocol" accept=".json" style="display: none;"> |
|
|
<input type="file" class="upload-input-protocol" accept=".json" style="display: none;"> |
|
|
<button class="select-file-btn-protocol">Load Local Protocol File</button> |
|
|
<button class="select-file-btn-protocol">Load Local Protocol File</button> |
|
|
</div> |
|
|
</div> |
|
|
<button class="download-protocol-file">Download Device File</button> |
|
|
<button class="download-protocol-file">Download Local Protocol File</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</section> |
|
|
</section> |
|
|
@ -563,7 +562,7 @@ |
|
|
<input type="file" class="upload-input-protocol" accept=".json" style="display: none;"> |
|
|
<input type="file" class="upload-input-protocol" accept=".json" style="display: none;"> |
|
|
<button class="select-file-btn-protocol">Load Local Protocol File</button> |
|
|
<button class="select-file-btn-protocol">Load Local Protocol File</button> |
|
|
</div> |
|
|
</div> |
|
|
<button class="download-protocol-file">Download Device File</button> |
|
|
<button class="download-protocol-file">Download Local Protocol File</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</section> |
|
|
</section> |
|
|
@ -653,7 +652,7 @@ |
|
|
const ssidTmpl = document.getElementById('ssid-template'); |
|
|
const ssidTmpl = document.getElementById('ssid-template'); |
|
|
const data = { |
|
|
const data = { |
|
|
/* Wi-Fi */ |
|
|
/* Wi-Fi */ |
|
|
wifi_static: 'off', wifi_ip: '', wifi_netmask: '', wifi_gateway: '', wifi_dns1: '', wifi_dns2: '', |
|
|
wifi_static: '', wifi_ip: '', wifi_netmask: '', wifi_gateway: '', wifi_dns1: '', wifi_dns2: '', |
|
|
|
|
|
|
|
|
/* Ethernet */ |
|
|
/* Ethernet */ |
|
|
eth_ip: '', eth_netmask: '', eth_gateway: '', |
|
|
eth_ip: '', eth_netmask: '', eth_gateway: '', |
|
|
@ -1257,18 +1256,6 @@ |
|
|
//ssid 행 추가 버튼 |
|
|
//ssid 행 추가 버튼 |
|
|
document.getElementById('add-ssid').addEventListener('click', addSsidRow); |
|
|
document.getElementById('add-ssid').addEventListener('click', addSsidRow); |
|
|
|
|
|
|
|
|
//ssid 행 삭제 버튼 |
|
|
|
|
|
document.getElementById('delete-ssid').addEventListener('click', () => { |
|
|
|
|
|
if (ssidList.children.length > 1) { |
|
|
|
|
|
ssidList.removeChild(ssidList.lastElementChild); |
|
|
|
|
|
} else if (ssidList.children.length === 1) { |
|
|
|
|
|
const firstRow = ssidList.firstElementChild; |
|
|
|
|
|
firstRow.querySelector('.ssid-name').value = ''; |
|
|
|
|
|
firstRow.querySelector('.ssid-pw').value = ''; |
|
|
|
|
|
firstRow.querySelector('select').value = 'none'; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
/*-----device input데이터 받는 함수------*/ |
|
|
/*-----device input데이터 받는 함수------*/ |
|
|
function collectDeviceData() { |
|
|
function collectDeviceData() { |
|
|
const res = { ...data }; |
|
|
const res = { ...data }; |
|
|
@ -1276,12 +1263,10 @@ |
|
|
res.wifi_static = document.querySelector('input[name="ipMode"]:checked')?.value === 'static' |
|
|
res.wifi_static = document.querySelector('input[name="ipMode"]:checked')?.value === 'static' |
|
|
? 'on' : 'off'; |
|
|
? 'on' : 'off'; |
|
|
|
|
|
|
|
|
// 일반 input/select 처리 |
|
|
|
|
|
for (const k in res) { |
|
|
for (const k in res) { |
|
|
const el = document.getElementById(k); |
|
|
const el = document.getElementById(k); |
|
|
if (el) { |
|
|
if (el) { |
|
|
const val = el.value.trim(); |
|
|
const val = el.value.trim(); |
|
|
// can_baudrate, rs485_baudrate는 숫자 or null |
|
|
|
|
|
if (['can_baudrate', 'rs485_baudrate'].includes(k)) { |
|
|
if (['can_baudrate', 'rs485_baudrate'].includes(k)) { |
|
|
res[k] = val === '' ? null : Number(val); |
|
|
res[k] = val === '' ? null : Number(val); |
|
|
} else { |
|
|
} else { |
|
|
@ -1289,18 +1274,27 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//x,y,z,부호 처리 |
|
|
// IMU select → 축·부호 분리 |
|
|
|
|
|
['x', 'y', 'z'].forEach(a => { |
|
|
['x', 'y', 'z'].forEach(a => { |
|
|
const { axis, sign } = axisValueToPair(document.getElementById(`imu_remap_${a}`).value); |
|
|
const { axis, sign } = axisValueToPair(document.getElementById(`imu_remap_${a}`).value); |
|
|
res[`imu_remap_${a}`] = axis; |
|
|
res[`imu_remap_${a}`] = axis; |
|
|
res[`imu_remap_${a}_sign`] = sign; |
|
|
res[`imu_remap_${a}_sign`] = sign; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// SSID 배열 |
|
|
|
|
|
res.WIFI_SSID = gatherSsidRows(); |
|
|
res.WIFI_SSID = gatherSsidRows(); |
|
|
|
|
|
|
|
|
return res; |
|
|
//null, 공백 없이 데이터 전처리 |
|
|
|
|
|
const filtered = {}; |
|
|
|
|
|
for (const [k, v] of Object.entries(res)) { |
|
|
|
|
|
if ( |
|
|
|
|
|
v !== null && |
|
|
|
|
|
!(typeof v === 'string' && v.trim() === '') |
|
|
|
|
|
) { |
|
|
|
|
|
filtered[k] = v; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return filtered; |
|
|
} |
|
|
} |
|
|
/*-----------------------------------------------------*/ |
|
|
/*-----------------------------------------------------*/ |
|
|
|
|
|
|
|
|
@ -1495,15 +1489,26 @@ |
|
|
node.querySelector('.ssid-name').value = obj.wifi_ssid ?? ''; |
|
|
node.querySelector('.ssid-name').value = obj.wifi_ssid ?? ''; |
|
|
node.querySelector('.ssid-pw').value = obj.wifi_password ?? ''; |
|
|
node.querySelector('.ssid-pw').value = obj.wifi_password ?? ''; |
|
|
node.querySelector('select').value = (obj.wifi_security ?? 'none').toLowerCase(); |
|
|
node.querySelector('select').value = (obj.wifi_security ?? 'none').toLowerCase(); |
|
|
|
|
|
|
|
|
|
|
|
const deleteBtn = document.createElement('button'); |
|
|
|
|
|
deleteBtn.textContent = '➖'; |
|
|
|
|
|
deleteBtn.dataset.action = 'delete-ssid'; |
|
|
|
|
|
deleteBtn.title = 'delete ssid'; |
|
|
|
|
|
deleteBtn.classList.add('delete-ssid'); |
|
|
|
|
|
|
|
|
|
|
|
node.appendChild(deleteBtn); |
|
|
|
|
|
|
|
|
return node; |
|
|
return node; |
|
|
} |
|
|
} |
|
|
/*-----------------------------------------------------*/ |
|
|
/*-----------------------------------------------------*/ |
|
|
|
|
|
|
|
|
/*-------ssid 데이터 리스트 추가 함수-----------*/ |
|
|
/*-------ssid password 숨김 함수-----------*/ |
|
|
function addSsidRow() { |
|
|
function addSsidRow() { |
|
|
ssidList.appendChild(createSsidRow()); |
|
|
ssidList.appendChild(createSsidRow()); |
|
|
} |
|
|
} |
|
|
|
|
|
function removeSsidRow(row) { |
|
|
|
|
|
row.remove(); |
|
|
|
|
|
} |
|
|
ssidList.addEventListener('click', e => { |
|
|
ssidList.addEventListener('click', e => { |
|
|
if (e.target.classList.contains('toggle-pw')) { |
|
|
if (e.target.classList.contains('toggle-pw')) { |
|
|
const pw = e.target.closest('.ssid-row').querySelector('.ssid-pw'); |
|
|
const pw = e.target.closest('.ssid-row').querySelector('.ssid-pw'); |
|
|
@ -1525,9 +1530,10 @@ |
|
|
const ssid = row.querySelector('.ssid-name').value.trim(); |
|
|
const ssid = row.querySelector('.ssid-name').value.trim(); |
|
|
const pw = row.querySelector('.ssid-pw').value.trim(); |
|
|
const pw = row.querySelector('.ssid-pw').value.trim(); |
|
|
const sec = row.querySelector('select').value; |
|
|
const sec = row.querySelector('select').value; |
|
|
|
|
|
if (ssid === '' && pw === '') return; |
|
|
if (ssid) arr.push({wifi_ssid: ssid, wifi_password: pw, wifi_security: sec}); |
|
|
if (ssid) arr.push({wifi_ssid: ssid, wifi_password: pw, wifi_security: sec}); |
|
|
}); |
|
|
}); |
|
|
return arr.length ? arr : [{wifi_ssid: '', wifi_password: '', wifi_security: 'none'}]; |
|
|
return arr |
|
|
} |
|
|
} |
|
|
/*-----------------------------------------------------*/ |
|
|
/*-----------------------------------------------------*/ |
|
|
|
|
|
|
|
|
@ -1717,6 +1723,7 @@ |
|
|
|
|
|
|
|
|
/*-------imu-remap 정수와 부호 분리 함수-------------*/ |
|
|
/*-------imu-remap 정수와 부호 분리 함수-------------*/ |
|
|
function axisValueToPair(val) { |
|
|
function axisValueToPair(val) { |
|
|
|
|
|
if (!val || val === '') return { axis: '', sign: '' }; |
|
|
return val.startsWith('-') |
|
|
return val.startsWith('-') |
|
|
? { axis: val.slice(1), sign: 'minus' } |
|
|
? { axis: val.slice(1), sign: 'minus' } |
|
|
: { axis: val, sign: 'plus' }; |
|
|
: { axis: val, sign: 'plus' }; |
|
|
@ -1740,8 +1747,8 @@ |
|
|
|
|
|
|
|
|
/* IMU select 값 재구성 */ |
|
|
/* IMU select 값 재구성 */ |
|
|
['x', 'y', 'z'].forEach(a => { |
|
|
['x', 'y', 'z'].forEach(a => { |
|
|
const axis = obj[`imu_remap_${a}`] || 'x'; |
|
|
const axis = obj[`imu_remap_${a}`] || ''; |
|
|
const sign = obj[`imu_remap_${a}_sign`] || 'plus'; |
|
|
const sign = obj[`imu_remap_${a}_sign`] || ''; |
|
|
document.getElementById(`imu_remap_${a}`).value = pairToAxisValue(axis, sign); |
|
|
document.getElementById(`imu_remap_${a}`).value = pairToAxisValue(axis, sign); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|