Registration Code (Part 1): w%kQ6
Registration Code (Part 2): b<#$1[*(cw~
In order to register on this forum, you must use the codes above. Combine them into one code (copy paste).

"Hacking" The Motorola FOCUS66 Camera

Personal posts regarding my releases and research on various topics.
jfarrell423
Posts: 2
Joined: Fri Aug 05, 2016 9:45 am

Re: "Hacking" The Motorola FOCUS66 Camera

Post by jfarrell423 » Fri Aug 05, 2016 9:57 am

Sorry I did not notice there were more pages to this post until after I submitted my question, I did find the cambozola jar on another site. I will review the other posts and see where that leads me.
Nufan1121
Posts: 4
Joined: Thu Sep 01, 2016 4:30 am

Re: "Hacking" The Motorola FOCUS66 Camera

Post by Nufan1121 » Thu Sep 01, 2016 4:36 am

Hi,

I've been doing a lot of hacking and playing with this camera using the information in this post, packet captures from the hubble app and other sources. I've almost finished writing a Windows client for this which can access it locally and remotely. If anyone is interested i don't mind sharing. It's a very frustrating piece of kit to work with and incredibly poorly designed in my opinion, but if you hack it about it can actually run ok :) I'm just finalising a bit of automation options before i take a break from it for my newly purchased ip camera.

In the future i'd like to implement more features to my client such as movement tracking/highlighting as i am using this as a security camera against most recommendations not to. Enjoying playing with it though :)
mikeparker
Posts: 1
Joined: Fri Sep 16, 2016 12:22 pm

Re: "Hacking" The Motorola FOCUS66 Camera

Post by mikeparker » Fri Sep 16, 2016 12:25 pm

I am interesested in a windows app to access this camera. The main issue is downloading the password for the router and disabling access to Hubble.
oooooooo
Posts: 1
Joined: Sun Oct 02, 2016 1:24 am

Re: "Hacking" The Motorola FOCUS66 Camera

Post by oooooooo » Sun Oct 02, 2016 1:30 am

Yes please Nufan1121 - I've been playing with this too - its a bit of a dog's dinner but has interesting challenges - you are well ahead of us all - interesting to see what you achive especialy movement tracking etc.
Nufan1121
Posts: 4
Joined: Thu Sep 01, 2016 4:30 am

Re: "Hacking" The Motorola FOCUS66 Camera

Post by Nufan1121 » Wed Dec 14, 2016 5:39 am

Hi,

I've still got the source code written in AutoIT, but i abandoned the project before anything brilliant was achieved. In it's state it currently shows the camera you input by ip and can send controls to the cameras. Sceenshots can be taken via a click of a button but there is no automation for this. The idea was to develop schedules for night vision control and automate the recording of images based on movement. There are AutoIT libraries for this but it is time consuming to set up and get perfect.

I never got round to doing all this because there is already a software out there called iSpy. It's what i'm now using for both of the cameras. There is a limit on the free version as to how many cameras you can add, but two works for me. It automated the recording separately to the horrible hubble app itself as it works on a movement algorithm on the feed from the camera. Mic options and movement are also included. There are even options for storage retention on a local or external drive and ftp functionality too. It's really great to be honest and i didn't see the point in re writing something that already exists.

There's also an android app to control it while away from your home. I advise using this whether it's on pc or your android phone as it beats the speeds of the hubble app hands down.

Cheers,

- Nufan
Marlan45
Posts: 3
Joined: Sun Jan 01, 2017 12:43 pm

Re: "Hacking" The Motorola FOCUS66 Camera

Post by Marlan45 » Sun Jan 01, 2017 12:46 pm

phonic wrote:if anyone is still interested, the PTZ commands that work with current firmware are:

move_backward
move_forward
move_left
move_right

add 9.9 to move max in any direction (e.g. move_left9.9)

They also work with iSpy PTZ and object tracking.

Question for you: Does it support steps command such has : move_left8.0?

Thank you.
Marlan45
Posts: 3
Joined: Sun Jan 01, 2017 12:43 pm

Re: "Hacking" The Motorola FOCUS66 Camera

Post by Marlan45 » Sun Jan 01, 2017 12:47 pm

Question for you: Does it support steps command such has : move_left8.0?

Thank you.
Marlan45
Posts: 3
Joined: Sun Jan 01, 2017 12:43 pm

Re: "Hacking" The Motorola FOCUS66 Camera

Post by Marlan45 » Sun Jan 01, 2017 12:50 pm

phonic wrote:if anyone is still interested, the PTZ commands that work with current firmware are:

move_backward
move_forward
move_left
move_right

add 9.9 to move max in any direction (e.g. move_left9.9)

They also work with iSpy PTZ and object tracking.

Question for you: Does it support steps command such has : move_left8.0?

Thank you.
zoogian
Posts: 1
Joined: Tue Jan 10, 2017 9:19 am

Re: "Hacking" The Motorola FOCUS66 Camera

Post by zoogian » Tue Jan 10, 2017 9:25 am

redrider8606 wrote:it sounds like you guys have figured this one out. I have been searching for hours trying to find a solution to the horrible software that comes with the focus66 camera. Can anyone here walk me through how to connect these to a 3rd party software where the feed isn't sent out to unknown sources? I don't know much about commands and how to send them to the camera so please if anyone can help it would be much appreciated.Thanks!!

Any luck on this?
Nufan1121
Posts: 4
Joined: Thu Sep 01, 2016 4:30 am

Re: "Hacking" The Motorola FOCUS66 Camera

Post by Nufan1121 » Wed Feb 08, 2017 2:59 am

Hi,

I thought i'd post my AutoIT code here to help people who are struggling with this. As i mentioned in previous posts, this is unfinished and by no means 'ready for release'. I abandoned this project to use iSpy but people are asking for assistance so i hope this helps:

Code: Select all

#include <GUIConstants.au3>
#include <VLC.au3>
#include <SliderConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiSlider.au3>
#Include <ScreenCapture.au3>
#include <Date.au3>
#include <File.au3>
#RequireAdmin

#Region todo
#comments-start
video status in English
add screen recording
#comments-end
#EndRegion todo

Const $ini_filename = @ScriptDir & "\VLC UDF Example.ini"
Const $iniSettings_filename = @ScriptDir & "\VLC UDF Example Settings.ini"
Const $log_filename = @ScriptDir & "\Logs.txt"
Dim $msg, $state = 0
Global $vlc1, $user_stop = False, $main_gui, $video_path_input
; -Check if ini file exists. If not, create it-
   If FileExists($ini_filename) = 0 Then
	  Local $ipAddress = InputBox("Input settings", "Please input IP address of the camera", "example: 127.0.0.1 or name.domain.com", "", _
             - 1, -1, default, default)
	  Local $port = InputBox("Input settings", "Please input the port for the camera (leave default for rtsp)", "6667", "", _
             - 1, -1, default, default)
	  Local $username = InputBox("Input settings", "Please input the username for the camera", "user", "", _
             - 1, -1, default, default)
	  Local $password = InputBox("Input settings", "Please input the password for the camera", "pass", "", _
             - 1, -1, default, default)
		 IniWrite($ini_filename, "Main", "videopath", "rtsp://" & $username & ":" & $password & "@" & $ipAddress & ":" & $port & "/blinkhd")
		 IniWrite($iniSettings_filename, "Main", "ip", $ipAddress)
		 _checkLogFile()
	  EndIf

_VLCErrorHandlerRegister()

; -Setup Main GUI-
$main_gui = GUICreate("VLC UDF Example", 800, 650, -1, -1)
GUICtrlCreateLabel("Video URL", 10, 10, 60, 20)
$video_path_input = GUICtrlCreateInput(IniRead($ini_filename, "Main", "videopath", ""), 70, 10, 600, 20)
$vlc1 = _GUICtrlVLC_Create(0, 50, 800, 450)

if $vlc1 = False then

	msgbox(0, "VLC UDF Example",	"_GUICtrlVLC_Create failed." & @CRLF & _
									"The most likely cause is that you don't have VLC installed." & @CRLF & _
									"Make sure VLC, and the ActiveX component, is installed.")
	Exit
 EndIf

; -Create GUI buttons-
$pause_button = GUICtrlCreateButton("Pause (Space)", 390, 500, 80, 20)
GUICtrlSetState($pause_button, $GUI_DISABLE)
$stop_button = GUICtrlCreateButton("Stop", 470, 500, 80, 20)
GUICtrlSetState($stop_button, $GUI_DISABLE)
$play_button = GUICtrlCreateButton("Play", 550, 500, 80, 20)
GUICtrlSetState($play_button, $GUI_DISABLE)
$close_button = GUICtrlCreateButton("Close (Esc)", 630, 500, 80, 20)
$mute_button = GUICtrlCreateButton("Mute (F8)", 710, 500, 80, 20)
;Sliders
GUICtrlCreateLabel("Volume (F6 && F7)", 370, 535, 80, 20)
$volume_slider = GUICtrlCreateSlider(450, 535, 250, 30)
GUICtrlSetLimit($volume_slider, 200)
GUICtrlSetData($volume_slider, _GUICtrlVLC_GetVolume($vlc1))
$volume_up = GUICtrlCreateDummy()
$volume_down = GUICtrlCreateDummy()
GUICtrlCreateLabel("Brightness", 370, 570, 80, 20)
$brightness_slider = GUICtrlCreateSlider(450, 570, 250, 30)
GUICtrlSetLimit($brightness_slider, 8)

;Directional buttons
$left_button = GUICtrlCreateButton("<", 720, 550, 20, 20)
GUICtrlSetState($left_button, $GUI_DISABLE)
$right_button = GUICtrlCreateButton(">", 760, 550, 20, 20)
GUICtrlSetState($right_button, $GUI_DISABLE)
$up_button = GUICtrlCreateButton("^", 740, 530, 20, 20)
GUICtrlSetState($up_button, $GUI_DISABLE)
$down_button = GUICtrlCreateButton("v", 740, 570, 20, 20)
GUICtrlSetState($down_button, $GUI_DISABLE)
GUICtrlCreateLabel("______________________________________________________________________________________________________________________________________________", 5, 600, 790, 75)
GUICtrlCreateLabel("Event History: ", 5, 620, 790, 15)
$log_input = GUICtrlCreateLabel("", 75, 620, 790, 75)
dim $main_gui_accel[8][2]=[["{ESC}", $close_button], ["{RIGHT}", $right_button], ["{LEFT}", $left_button], ["{DOWN}", $down_button], ["{UP}", $up_button], ["{F6}", $volume_down], ["{F7}", $volume_up], ["{F8}", $mute_button]]

;tab1-information
GUICtrlCreateTab(5, 500, 350, 100)
GUICtrlCreateTabItem("Information")
GUICtrlCreateLabel("Video Status", 10, 535, 80, 20)
$status_input = GUICtrlCreateInput("", 75, 535, 20, 20)
GUICtrlCreateLabel("Temperature", 100, 535, 80, 20)
$temp_input = GUICtrlCreateInput("", 165, 535, 30, 0)
GUICtrlCreateLabel("Night Vision", 200, 535, 60, 20)
$nvON_radio = GUICtrlCreateradio("On", 260, 535, 80, 20)
$nvOff_radio = GUICtrlCreateradio("Off", 260, 555, 80, 20)
$nvAuto_radio = GUICtrlCreateradio("Auto", 260, 575, 80, 20)
GUICtrlCreateLabel("MAC Address", 10, 570, 80, 20)
$mac_input = GUICtrlCreateInput("", 80, 570, 80, 20)
GUICtrlCreateLabel("WiFi", 170, 570, 80, 20)
$wifi_input = GUICtrlCreateInput("", 195, 570, 40, 20)
;tab2-media
GUICtrlCreateTabItem("Media")
$backward_button = GUICtrlCreateButton("Screenshot", 10, 535, 80, 20)
GUICtrlSetState($backward_button, $GUI_DISABLE)
GUICtrlCreateTabItem("Automation")
;close tab
GUICtrlCreateTabItem("")

; -Show Main GUI-
GUISetState(@SW_SHOW)
GUISetAccelerators($main_gui_accel)

; -Load last video stream-
if StringLen(GUICtrlRead($video_path_input)) > 0 Then UpdateGUIAndPlay(GUICtrlRead($video_path_input))
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

if StringLen(GUICtrlRead($video_path_input)) > 0 Then $state = _GUICtrlVLC_GetState($vlc1)
if $state = 3 Then GUICtrlSetState($play_button, $GUI_DISABLE)

_getCommand("get_mac_address", $mac_input)
_checkLogFile()

; -Main Loop-
While 1
	; -Get the video state, temperature and wifi signal-
	_getTemp("value_temperature", $temp_input)
	_getWifi("get_wifi_strength", $wifi_input)

   if StringLen(GUICtrlRead($video_path_input)) > 0 Then
		$state = _GUICtrlVLC_GetState($vlc1)
		GUICtrlSetData($status_input, $state)
	 EndIf

    ; -Button watchers-
	if $msg = $volume_slider Then
		_GUICtrlVLC_SetVolume($vlc1, GUICtrlRead($volume_slider))
		_writeToLog("Command", "Volume changed")
	EndIf

	if $msg = $volume_down Then
		$new_vol = _GUICtrlVLC_GetVolume($vlc1) - 10
		if $new_vol < 0 then $new_vol = 0
		_GUICtrlVLC_SetVolume($vlc1, $new_vol)
		GUICtrlSetData($volume_slider, $new_vol)
	EndIf

	if $msg = $volume_up Then
		$new_vol = _GUICtrlVLC_GetVolume($vlc1) + 10
		if $new_vol > 200 then $new_vol = 200
		_GUICtrlVLC_SetVolume($vlc1, $new_vol)
		GUICtrlSetData($volume_slider, $new_vol)
	EndIf

	if $msg = $mute_button Then
		if _GUICtrlVLC_GetMute($vlc1) = True Then
			_GUICtrlVLC_SetMute($vlc1, False)
		Else
			_GUICtrlVLC_SetMute($vlc1, True)
		EndIf
	EndIf

	if $msg = $left_button Then
	  GUICtrlSetState($left_button, $GUI_DISABLE)
	   _sendCommand("move_left")
	   Sleep(1000)
	   _sendCommand("lr_stop")
	    _writeToLog("Command", "Sent move left")
	  GUICtrlSetState($left_button, $GUI_ENABLE)
	EndIf

   if $msg = $right_button Then
	  GUICtrlSetState($right_button, $GUI_DISABLE)
	   _sendCommand("move_right")
	   Sleep(1000)
	   _sendCommand("lr_stop")
	    _writeToLog("Command", "Sent move right")
	  GUICtrlSetState($right_button, $GUI_ENABLE)
	EndIf

   if $msg = $up_button Then
	  GUICtrlSetState($up_button, $GUI_DISABLE)
	   _sendCommand("move_backward")
	   Sleep(1000)
	   _sendCommand("fb_stop")
	    _writeToLog("Command", "Sent move up")
	   GUICtrlSetState($up_button, $GUI_ENABLE)
	EndIf

   if $msg = $down_button Then
	  GUICtrlSetState($down_button, $GUI_DISABLE)
	   _sendCommand("move_forward")
	   Sleep(1000)
	   _sendCommand("fb_stop")
	   _writeToLog("Command", "Sent move down")
	   GUICtrlSetState($down_button, $GUI_ENABLE)
   EndIf

   If $msg = $backward_button Then
		_ScreenShot($main_gui)
	 EndIf

   If GUICtrlRead($nvOff_Radio) = 1 Then
		_changeCommand("set_night_vision&value=0")
		_writeToLog("Command", "night vision disabled")
		EndIf
   If GUICtrlRead($nvOn_Radio) = 1 Then
		_changeCommand("set_night_vision&value=1")
		_writeToLog("Command", "night vision enabled")
		EndIf
   If GUICtrlRead($nvAuto_Radio) = 1 Then
		_changeCommand("set_night_vision&value=2")
		_writeToLog("Command", "night vision auto")
	 EndIf

   If $msg = $brightness_slider Then
	  GUICtrlSetState($brightness_slider, $GUI_DISABLE)
	  _BrightnessMoved()
	  GUICtrlSetState($brightness_slider, $GUI_ENABLE)
	  EndIf

	if $msg = $pause_button Then
		_GUICtrlVLC_Pause($vlc1)
	 EndIf

	if $msg = $stop_button Then

			_GUICtrlVLC_Stop($vlc1)
			$user_stop = True
			GUICtrlSetState($backward_button, $GUI_DISABLE)
			GUICtrlSetState($left_button, $GUI_DISABLE)
			GUICtrlSetState($right_button, $GUI_DISABLE)
			GUICtrlSetState($down_button, $GUI_DISABLE)
			GUICtrlSetState($up_button, $GUI_DISABLE)
			GUICtrlSetState($pause_button, $GUI_DISABLE)
			GUICtrlSetState($stop_button, $GUI_DISABLE)
			GUICtrlSetState($play_button, $GUI_ENABLE)
			GUICtrlSetState($nvOff_Radio, $GUI_DISABLE)
			GUICtrlSetState($nvOn_Radio, $GUI_DISABLE)
			GUICtrlSetState($nvAuto_Radio, $GUI_DISABLE)
			GUICtrlSetState($volume_slider, $GUI_DISABLE)
			GUICtrlSetState($brightness_slider, $GUI_DISABLE)
	EndIf

	if $msg = $play_button Then

			$user_stop = False
			$vlc1.playlist.play()
			GUICtrlSetState($backward_button, $GUI_ENABLE)
			GUICtrlSetState($left_button, $GUI_ENABLE)
			GUICtrlSetState($right_button, $GUI_ENABLE)
			GUICtrlSetState($down_button, $GUI_ENABLE)
			GUICtrlSetState($up_button, $GUI_ENABLE)
			GUICtrlSetState($pause_button, $GUI_ENABLE)
			GUICtrlSetState($stop_button, $GUI_ENABLE)
			GUICtrlSetState($play_button, $GUI_DISABLE)
			GUICtrlSetState($nvOff_Radio, $GUI_ENABLE)
			GUICtrlSetState($nvOn_Radio, $GUI_ENABLE)
			GUICtrlSetState($nvAuto_Radio, $GUI_ENABLE)
			GUICtrlSetState($volume_slider, $GUI_ENABLE)
			GUICtrlSetState($brightness_slider, $GUI_ENABLE)
	EndIf

	If $msg = $GUI_EVENT_CLOSE or $msg = $close_button Then
		IniWrite($ini_filename, "Main", "videopath", GUICtrlRead($video_path_input))
		_writeToLog("Command", "Program was closed")
		ExitLoop
	EndIf

	$msg = GUIGetMsg()
 WEnd

#Region Functions

Func UpdateGUIAndPlay($path = "")

		GUICtrlSetState($play_button, $GUI_DISABLE)
		if StringLen($path) > 0 Then
			GUICtrlSetData($video_path_input, $path)
			_GUICtrlVLC_Clear($vlc1)
			_GUICtrlVLC_Play($vlc1, _GUICtrlVLC_Add($vlc1, GUICtrlRead($video_path_input)))
		Else

			_GUICtrlVLC_Play($vlc1, 0)
		EndIf
		While _GUICtrlVLC_GetState($vlc1) <> 3
		WEnd
			GUICtrlSetState($backward_button, $GUI_ENABLE)
			GUICtrlSetState($left_button, $GUI_ENABLE)
			GUICtrlSetState($right_button, $GUI_ENABLE)
			GUICtrlSetState($down_button, $GUI_ENABLE)
			GUICtrlSetState($up_button, $GUI_ENABLE)
			GUICtrlSetState($pause_button, $GUI_ENABLE)
			GUICtrlSetState($stop_button, $GUI_ENABLE)
			GUICtrlSetState($play_button, $GUI_DISABLE)
			GUICtrlSetState($nvOff_Radio, $GUI_ENABLE)
			GUICtrlSetState($nvOn_Radio, $GUI_ENABLE)
			GUICtrlSetState($nvAuto_Radio, $GUI_ENABLE)
			GUICtrlSetState($volume_slider, $GUI_ENABLE)
			GUICtrlSetState($brightness_slider, $GUI_ENABLE)
EndFunc

Func _ScreenShot(ByRef $target)
   Local $result = 0
   Local $sDir = "\CCTV\Screenshots\"
   While $result < 1
   	  Local $iFileExists = FileExists(_GetProgramFiles() & $sDir)
	      If $iFileExists Then
			   _ScreenCapture_CaptureWnd(_GetProgramFiles() & $sDir & "CCTV_Screenshot" & _DateTime() & ".jpg", $target)
			   _writeToLog("Command", "Screenshot success! Stored in: " & _GetProgramFiles() & $sDir)
			   $result = 1
			Elseif @error Then
			   _writeToLog("Error" & @error)
			Else
			   DirCreate(_GetProgramFiles() & $sDir)
		 EndIf
	  WEnd; This could potenitally break if the directory couldn't be created for permissiosn reasons etc - test it later
 EndFunc   ;==>Example

Func _DateTime()
	$date = StringReplace(_NowDate(), "/", "_")
	$time = StringReplace(_NowTime(), " ", "")
	$timenew = StringReplace($time, ":", ".")
	$timedate = $date & "_at_"& $timenew
	Return $timedate
 EndFunc   ;==>_DateTime

Func _GetProgramFiles()
   $ProgramFilesDir = EnvGet('ProgramFiles(x86)')
   if not $ProgramFilesDir then $ProgramFilesDir = @ProgramFilesDir
	  Return $ProgramFilesDir
   EndFunc

Func _BrightnessMoved()
   If GUICtrlRead($brightness_slider) = 1 Then
		_changeCommand("set_brightness&value=1")
		_writeToLog("Command", "brightness changed to 1")
		EndIf
   If GUICtrlRead($brightness_slider) = 2 Then
		_changeCommand("set_brightness&value=2")
		_writeToLog("Command", "brightness changed to 2")
		EndIf
   If GUICtrlRead($brightness_slider) = 3 Then
		_changeCommand("set_brightness&value=3")
		_writeToLog("Command", "brightness changed to 3")
	 EndIf
   If GUICtrlRead($brightness_slider) = 4 Then
		_changeCommand("set_brightness&value=3")
		_writeToLog("Command", "brightness changed to 4")
	 EndIf
   If GUICtrlRead($brightness_slider) = 5 Then
		_changeCommand("set_brightness&value=5")
		_writeToLog("Command", "brightness changed to 5")
	 EndIf
   If GUICtrlRead($brightness_slider) = 6 Then
		_changeCommand("set_brightness&value=6")
		_writeToLog("Command", "brightness changed to 6")
	 EndIf
   If GUICtrlRead($brightness_slider) = 7 Then
		_changeCommand("set_brightness&value=7")
		 _writeToLog("Command", "brightness changed to 7")
	 EndIf
   If GUICtrlRead($brightness_slider) = 8 Then
		_changeCommand("set_brightness&value=8")
		_writeToLog("Command", "brightness changed to 8")
   EndIf
   EndFunc


; -HTTP commands-
Func _sendCommand(ByRef $action)
   $ip = IniRead($iniSettings_filename, "Main", "ip", "")
   $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
   $oHTTP.Open("GET", "http://" & $ip & "/?action=command&command=" & $action, False)
   $oHTTP.Send()
EndFunc

Func _getTemp(ByRef $info, ByRef $inputbox)
   $ip = IniRead($iniSettings_filename, "Main", "ip", "")
   $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
   $oHTTP.Open("GET", "http://" & $ip & "/?action=command&command=" & $info, False)
   $oHTTP.Send()
   $oReceived = $oHTTP.ResponseText
   $aMatch = StringRegExp($oReceived, '([0-9]{1,3}\D.)', 1)
			   If @error == 0 Then
	  GUICtrlSetData($inputbox, $aMatch[0])
   Else
	  GUICtrlSetData($inputbox, "N/A")
   EndIf
EndFunc

Func _changeCommand(ByRef $setting)
   $ip = IniRead($iniSettings_filename, "Main", "ip", "")
   $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
   $oHTTP.Open("POST", "http://" & $ip & "/?action=command&command=" & $setting, False)
   $oHTTP.Send()
EndFunc

Func _getCommand(ByRef $command, ByRef $inputbox)
   $ip = IniRead($iniSettings_filename, "Main", "ip", "")
   $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
   $oHTTP.Open("GET", "http://" & $ip & "/?action=command&command=" & $command, False)
   $oHTTP.Send()
   $oReceived = $oHTTP.ResponseText
			   If @error == 0 Then
	  GUICtrlSetData($inputbox, $oReceived)
   Else
	  GUICtrlSetData($inputbox, "N/A")
	  _writeToLog("Error", "Failed to " & $command);might break
   EndIf
EndFunc

Func _getWifi(ByRef $info, ByRef $inputbox)
   $ip = IniRead($iniSettings_filename, "Main", "ip", "")
   $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
   $oHTTP.Open("GET", "http://" & $ip & "/?action=command&command=" & $info, False)
   $oHTTP.Send()
   $oReceived = $oHTTP.ResponseText
   $aMatch = StringRegExp($oReceived, '([0-9]{1,3})', 1)
			   If @error == 0 Then
	  GUICtrlSetData($inputbox, $aMatch[0] & '%')
   Else
	  GUICtrlSetData($inputbox, "N/A")
   EndIf
EndFunc

; Logging functions
Func _checkLogFile()
   Local $FileExists = FileExists($log_filename)
   Local $logRecord = "New log file created on " & _DateTime()
   if $FileExists = 0 Then
	  ;MsgBox (0, "", $FileExists)
	  FileOpen($log_filename, 1)
	  FileWrite ($log_filename, $logRecord)
	  FileWrite($log_filename,@CRLF)
	  FileClose($log_filename)
	  GUICtrlSetData($log_input, $logRecord)
	  EndIf
   EndFunc

Func _writeToLog(ByRef $type, ByRef $data)
   GUICtrlSetData($log_input, $data)
   _checkLogFile()
   FileOpen($log_filename, 1)
   FileWrite($log_filename, $type & ": " & $data & " on " & _DateTime())
   FileWrite($log_filename,@CRLF)
   FileClose($log_filename)
EndFunc
#EndRegion Functions
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest