Sub Camera1_PreviewTaken (PictureFrame() As Byte)
Log("Preview Taken")
CurrentJPEG = PictureFrame
If connected Then
If AStreams.IsInitialized = False Then Return
Astreams.Write(AddCommandToBytes(IMAGE_BYTE, CurrentJPEG, CurrentJPEG.Length))
Log("Sending: Image ")
Else
Msgbox("You are not connected.","Connection")
End If
End Sub
Sub AddCommandToBytes(Command As Byte, Buffer() As Byte, Length As Int) As Byte()
Dim b(Length + 1) As Byte
b(0) = Command
BC.ArrayCopy(Buffer, 0, b, 1, Length)
Return b
End Sub
Sub AStreams_NewData (Buffer() As Byte)
Dim command As Byte
command = Buffer(0)
Select command
Case TEXT_BYTE
Dim msg As String
msg = BytesToString(Buffer, 1, Buffer.Length-1, "UTF8")
Msgbox(msg, "")
Case IMAGE_BYTE
Dim b() As Byte
BC.ArrayCopy(Buffer, 1, b, 0, Buffer.Length-1)
Camera1.uploadFrame(b, "http://www.mywebsite.net/index.php")
End Select
End Sub