Forum

Diese Foren dienen dem Austausch und der Unterstützung der Entwicklungspartner für GPSoverIP/DATAoverIP und HLD.

Nutzen Sie diese zur direkten Kommunikation mit dem Entwicklungsteam der GPSoverIP GmbH und anderen Entwicklern. Anfragen über die Foren werden mit erhöhter Priorität bearbeitet.

Achten Sie bitte bei der Kommunikation auf die Netiquette, um allen Beteiligten die Arbeit mit den Foren zu erleichtern.

VB.net -> Questions with the unzip

Gast

We made some tests with the API and I have some questions for you :

1. I tried Devices – Get - PackageList module to retrieve the GPS log. The response is compressed as you told me, but although I tried eveything I couldn’t uncompress it using zlib library.
I replaced the @@1@@, @@3@@, @@4@@ strings, skipped the first 4 characters. If I don’t do these I receive “Unknown compression method” from zlib. If I do the replacements I receive “Dictionary needed” exception fro mzlib. So do you have an example for any .net languauge?

2. I tried Devices –Get - Position API to retrieve the current position of the device but always received “return:-1” result from http://www.apioverip.de address.

Best regards
Emre


GPSoverIP GmbH

Hi Emre,

1. My colleague will make an example for you. But normally you did everything the right way -replace and skip the first characters- have you tried some other unzips?

2. Please use the URL live.apioverip.de for the post, because all the live-data comes through this url. Thats why you didn't get any other answer.
You'll find the URL on top of the orange part in the API documentation.

Best regards
Patric


Gast

Good Morning Patric,

Your system runs on php, so you’re using gzcompress and gzuncompress methods. I was confused about these special character replacements.

For @@1@@ your example uses chr(0) replacement. chr(0) is empty (null) and chr(32) is space (‘ ‘). So we’re replacing @@1@@ with an empty string, not a space. Is this the correct replacement?

Another thing is the zlib exception, I receive an exception like “need dictionary”.

According to zlib (http://www.zlib.net/manual.html#inflateSetDictionary) you can use a inflateSetDictionary method if you received and “Z_NEED_DICT” error. So this means deflateSetDictionary was used before the compression so the client needs the same dictionary to decompress the data. Is there a special string which used?

Best regards


GPSoverIP GmbH

Hi Emre,

we developed a little example for the use with VB .Net.
First we faced the same problems you explained.
Problem is a matter of letter encoding.

The bold line in the code seems to be the solution.

Replacement of @@1@@ has to be done with chr(0) not with ‘’.

Writing the stream to a file is not the smartest solution, but this another task.

If there are further questions, to not hesitate to contact us.

Please keep us up-to-date. Thanks.

++++++++++++++++++++++++++++++++++++++++++++++++
Public Shared Sub CopyStream(ByRef input As System.IO.Stream, ByRef output As System.IO.Stream)

Dim num1 As Integer
Dim buffer1 As Byte() = New Byte(2000 - 1) {}
num1 = input.Read(buffer1, 0, 2000)
Do While (num1 > 0)
output.Write(buffer1, 0, num1)
num1 = input.Read(buffer1, 0, 2000)
Loop
output.Flush()
End Sub

Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim outFileStream As New System.IO.FileStream("C:\decompressed.txt", System.IO.FileMode.Create)

Dim zStream As New zlib.ZOutputStream(outFileStream)

'Dim inFileStream As New System.IO.FileStream(inFile, System.IO.FileMode.Open)

Dim request2 As Net.HttpWebRequest = Net.HttpWebRequest.Create("...URL..."

request2.Method = "GET"

Dim response2 As Net.HttpWebResponse = request2.GetResponse

Dim reader2 As IO.StreamReader = New IO.StreamReader(response2.GetResponseStream, System.Text.Encoding.Default)

Dim TextFromServer As String = reader2.ReadToEnd

Dim strToReplace As String = ""

strToReplace = TextFromServer
strToReplace = Strings.Replace(strToReplace, "@@1@@", Chr(0))
strToReplace = Strings.Replace(strToReplace, "@@3@@", ";"
strToReplace = Strings.Replace(strToReplace, "@@4@@", ":"
strToReplace = Strings.Right(strToReplace, Strings.Len(strToReplace) - 4)

FileOpen(1, "C:\temp.txt", OpenMode.Binary, OpenAccess.Write)
FilePut(1, strToReplace)
FileClose(1)

Dim inFileStream As New System.IO.FileStream("C:\temp.txt", System.IO.FileMode.Open)

Try
Form1.CopyStream(inFileStream, zStream)
Finally
zStream.Close()
inFileStream.Close()
outFileStream.Close()
End Try

MsgBox("Fertig"
End Sub

++++++++++++++++++++++++++++++++++++++++++++++++
Regards
Matthias


Gast

Hi Matthias,

Thanks for the example, I’m not in the office today so I’ll inform you about the results tomorrow.

Actually I’m surprised because I think I tried all encoding options, but if it works then I missed something before.

Best regards.

Emre


GPSoverIP GmbH

Hi Emre,

The silly thing is that you have to set the option “default”.
It was also not really the option I would have been selected.
Shouldn’t it be the default anyway?! But it worked afterwards

Have a nice day.
Matthias


Gast

Hi,

I’ve successfully got the API response.
I’ll try more API methods and inform you if I’m stuck.

Thanks for the support.

Best regards.


Sie haben noch Fragen? Jetzt unverbindlich beraten lassen!

Home/Produkte/Teststellung/Kontodaten

Main
Kundenbetreuung direkt kontaktieren: +49 (0) 9721 796973-0
Die Sicherheit Ihrer persönlichen Daten hat für uns höchste Priorität. Weitere Einzelheiten finden Sie in unserer Datenschutzerklärung.

Nehmen Sie Kontakt mit uns auf

+49 9721 796 973 30
+49 9721 796 973 59

Geben Sie Ihre Telefonnummer an, wenn Sie einen Rückruf wünschen.

Suche
Hardware-Komponenten
Software-Komponenten
Mediathek
E-Mail
Telefon
Support
Zum Online-Shop
Zum GPS-Explorer
Sprache wählen
EN
GR
IT
ES
FR
TR
Seite drucken