Jump to content

Canada's top-tier Telescopes & Accessories
Be as specific as possible when reporting issues and *ALWAYS* include the full version number of the application you are using and your exact *CAMERA MODEL*
NEVER POST YOUR KEY IN ANY PUBLIC FORUM, INCLUDING THE O'TELESCOPE SUPPORT FORUM ::: IF YOU DO YOUR KEY WILL BE DEACTIVATED WITHOUT NOTICE!
  • 0

VB.net program and BYE crashes


Riccardo.Sordo

Question

hi...

I have completed the final control program BYE ... But I have a problem. After two or three shots BYE crashes almost always. It happens with photos longer than 30 or 40 seconds. Some idea?

 

Spectre...

hi, I have completed the final control program BYE ... But I have a problem. After two or three shots BYE crashes almost always. It happens with photos longer than 30 or 40 seconds. Some idea?

Link to comment
Share on other sites

  • Answers 9
  • Created
  • Last Reply

9 answers to this question

Recommended Posts

hi!

 

No error ... during the download of the image usually remains locked ... I know it's not a vb.net application. I used the network method request to send the command string for the capture of single click.

Public Sub TakePicture(sender As System.Object, e As System.EventArgs)
        I_BYE = 1
        BackyardTcpClient.SendCommand(String.Format("takepicture target:{0} duration:{1} iso:{2} quality:{3} imagetype:{4} bin:{5}", NomeIMG(I_BYE), TempoIMG(I_BYE), IsoIMG(I_BYE), quality, TipoIMG(I_BYE), bin))
End Sub

Public Function SendCommand(command As String, Optional keepalive As Boolean = True) As String
        If TcpClient Is Nothing Then
            InitializeTcpClient()
        End If

        Try
            If TcpClient Is Nothing Then
                Return String.Empty
            End If
            If TcpClient.Client Is Nothing Then
                Return String.Empty
            End If

            If Not TrySend(command, Not keepalive) Then
                ' This is a nice way to recover gracefully if the connection to the host 
                ' application is lost and available again when keepalive is used.
                InitializeTcpClient()
                TrySend(command)
            End If


            If command.StartsWith("get", StringComparison.InvariantCultureIgnoreCase) Then
                Return ReceiveData()
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            TerminateTcpClient()
        Finally
            If Not keepalive Then
                TerminateTcpClient()
            End If
        End Try

        Return ""
 End Function

No error ... during the download of the image usually remains locked ... I know it's not a vb.net application. I used the network method request to send the command string for the capture of single click.

Link to comment
Share on other sites

I have been using Guylain's API for a couple of years without any issues.

 

Typically, you would follow these basic steps, after creating the client

 

1) issue a takepicture command

2) wait for the duration of the exposure to expire

3) poll BYE periodically by issuing a getpictureready command

4) If the camera reports that the picture is ready within a reasonable time you then issue a getpicturepath command to get the location of the downloaded image.

 

Your code fragments do not show much of that logic path.

 

Sorry but without debugging through your code, it is not possible to figure out what is going on.

Link to comment
Share on other sites

 

Riccardo,

 

Back about 6 months ago I upgraded to a new version of Guylain's API and I did notice a problem that I reported to Guylain and forgot about. Here is what I saw....

 

When the getispictureready command returns true I call getpicturepath. If I immediately try to use the returned path to move the image file to a different folder I sometimes get an exception because the file is in use by another process, presumably BYE.

 

My solution was to trap the exception, sleep for 100 milliseconds, and loop retry the move. It eventually succeeds. Here is my C# code. If the image is not available for calling code then it reports the problem.

 

I hope this helps.

 

public override string GetImage()

{

if ( !ImageReady )

{

return null;

}

 

string imagePath = SendCommand( "getpicturepath" );

string fileName = Path.GetFileName( imagePath );

string destPath = Path.Combine( WorkingFolder, fileName );

 

int cnt = 0;

 

while ( cnt <= 10 )

{

try

{

File.Move( imagePath, destPath );

break;

}

catch ( Exception )

{

++cnt;

Thread.Sleep( 100 );

}

}

 

return destPath;

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...

Important Information

This site uses cookies to offer your a better browsing experience. You can adjust your cookie settings. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to the use of cookies, our Privacy Policy, and our Terms of Use