@@ -308,12 +308,81 @@ void iecFuji::process_cmd()
308308
309309void iecFuji::local_ip ()
310310{
311+ char tmp[20 ];
312+ Debug_printv (" Getting local IP address" );
311313 fnSystem.Net .get_ip4_info (cfg.localIP , cfg.netmask , cfg.gateway );
312- std::ostringstream ss;
313- ss << cfg.localIP [0 ] << " ." << cfg.localIP [1 ] << " ." << cfg.localIP [2 ] << " ." << cfg.localIP [3 ];
314- set_fuji_iec_status (0 , ss.str ());
314+ snprintf (tmp, sizeof (tmp), " %d.%d.%d.%d" , cfg.localIP [0 ], cfg.localIP [1 ], cfg.localIP [2 ], cfg.localIP [3 ]);
315+ response = string (tmp);
316+ response = mstr::toPETSCII2 (response);
317+ set_fuji_iec_status (0 , response);
318+ }
319+
320+ void iecFuji::netmask ()
321+ {
322+ char tmp[20 ];
323+ Debug_printv (" Getting netmask" );
324+ fnSystem.Net .get_ip4_info (cfg.localIP , cfg.netmask , cfg.gateway );
325+ snprintf (tmp, sizeof (tmp), " %d.%d.%d.%d" , cfg.netmask [0 ], cfg.netmask [1 ], cfg.netmask [2 ], cfg.netmask [3 ]);
326+ response = string (tmp);
327+ response = mstr::toPETSCII2 (response);
328+ set_fuji_iec_status (0 , response);
329+ }
330+
331+ void iecFuji::gateway ()
332+ {
333+ char tmp[20 ];
334+ Debug_printv (" Getting gateway" );
335+ fnSystem.Net .get_ip4_info (cfg.localIP , cfg.netmask , cfg.gateway );
336+ snprintf ((char *)tmp, sizeof (tmp), " %d.%d.%d.%d" , cfg.gateway [0 ], cfg.gateway [1 ], cfg.gateway [2 ], cfg.gateway [3 ]);
337+ response = string (tmp);
338+ response = mstr::toPETSCII2 (response);
339+ set_fuji_iec_status (0 , response);
340+ }
341+
342+ void iecFuji::dns_ip ()
343+ {
344+ Debug_printv (" Getting DNS IP" );
345+ fnSystem.Net .get_ip4_dns_info (cfg.dnsIP );
346+ char tmp[20 ];
347+ snprintf ((char *)tmp, sizeof (tmp), " %d.%d.%d.%d" , cfg.dnsIP [0 ], cfg.dnsIP [1 ], cfg.dnsIP [2 ], cfg.dnsIP [3 ]);
348+ response = string (tmp);
349+ response = mstr::toPETSCII2 (response);
350+ set_fuji_iec_status (0 , response);
351+ }
352+
353+ void iecFuji::mac_address ()
354+ {
355+ Debug_printv (" Getting MAC address" );
356+ uint8_t mac[6 ];
357+ fnWiFi.get_mac (mac);
358+ char tmp[24 ];
359+
360+ snprintf (tmp, sizeof (tmp), " %02X-%02X-%02X-%02X-%02X-%02X" , mac[0 ], mac[1 ], mac[2 ], mac[3 ], mac[4 ], mac[5 ]);
361+ response = string (tmp);
362+ response = mstr::toPETSCII2 (response);
363+ set_fuji_iec_status (0 , response);
315364}
316365
366+ void iecFuji::bssid ()
367+ {
368+ Debug_printv (" Getting BSSID" );
369+ uint8_t bssid[6 ];
370+ fnWiFi.get_current_bssid (bssid);
371+ char tmp[24 ];
372+ snprintf (tmp, sizeof (tmp), " %02X-%02X-%02X-%02X-%02X-%02X" , bssid[0 ], bssid[1 ], bssid[2 ], bssid[3 ], bssid[4 ], bssid[5 ]);
373+ response = string (tmp);
374+ set_fuji_iec_status (0 , response);
375+ response = mstr::toPETSCII2 (response);
376+ }
377+
378+ void iecFuji::fn_version ()
379+ {
380+ Debug_printv (" Getting FujiNet version" );
381+ std::string ver = fnSystem.get_fujinet_version (true );
382+ set_fuji_iec_status (0 , ver);
383+ response = ver;
384+ response = mstr::toPETSCII2 (response);
385+ }
317386
318387void iecFuji::process_basic_commands ()
319388{
@@ -388,6 +457,18 @@ void iecFuji::process_basic_commands()
388457 get_status_basic ();
389458 else if (payload.find (" localip" ) != std::string::npos)
390459 local_ip ();
460+ else if (payload.find (" netmask" ) != std::string::npos)
461+ netmask ();
462+ else if (payload.find (" gateway" ) != std::string::npos)
463+ gateway ();
464+ else if (payload.find (" dnsip" ) != std::string::npos)
465+ dns_ip ();
466+ else if (payload.find (" macaddress" ) != std::string::npos)
467+ mac_address ();
468+ else if (payload.find (" bssid" ) != std::string::npos)
469+ bssid ();
470+ else if (payload.find (" fnversion" ) != std::string::npos)
471+ fn_version ();
391472 else if (payload.find (" enable" ) != std::string::npos)
392473 enable_device_basic ();
393474 else if (payload.find (" disable" ) != std::string::npos)
@@ -662,6 +743,7 @@ void iecFuji::net_scan_result_basic()
662743 int i = atoi (pt[1 ].c_str ());
663744 scan_result_t result = net_scan_result (i);
664745 response = std::to_string (result.rssi ) + " ,\" " + std::string (result.ssid ) + " \" " ;
746+ response = mstr::toPETSCII2 (response);
665747 set_fuji_iec_status (0 , " ok" );
666748}
667749
@@ -786,6 +868,7 @@ void iecFuji::net_get_wifi_status_raw()
786868void iecFuji::net_get_wifi_status_basic ()
787869{
788870 response = net_get_wifi_status () == 3 ? " connected" : " disconnected" ;
871+ response = mstr::toPETSCII2 (response);
789872 set_fuji_iec_status (0 , " ok" );
790873}
791874
0 commit comments