Home Page | Forum | Downloads | About us | Services | Products | Online Portal | Site Map | Contact Us

motorola
July 21, 2019, 03:06:49 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Contact Admin Team Search Login Register  

Radio Services

Supply Radios, Spare Parts, Programming Cables, Flash Adapters

Members area provides radio programming videos

If we have helped you, please make a donation, however small. This helps us develop the site and offer better services.

Advert

Pages: [1]   Go Down
  Print  
Author Topic: MBXML  (Read 191 times)
0 Members and 1 Guest are viewing this topic.
mmjc23
Basic Account


FeedBack +0/-0
Offline Offline

Posts: 2


« on: May 10, 2019, 01:08:48 PM »

Hello,
I have to develop a custom Vb.Net dispatcher connected to a control station using a USB cable.
So I started developing the Presence Notifier service and now I correctly receive (port 4005) ARS registrations/deregistrations from remote radios.
Now I have to develop the Location service (port 4001) and then I read the "Motorola Binary XML Encoding Specification" and "Location Request and Response Protocol Specification" documents.

But I don't understand how to implement the MBXML protocol in my application...it's all very confusing.

When I get the data from the radio ... am I sure to find the whole mbxml document in the radio's UDP buffer or could it be split into multiple buffers?
Could it happen that in the same udp radio buffer there are more concatenated mbxml documents?

Should I define a list of variables / structures that reproduce the structure of the XML and deserialize the data received in my structures?
Or do I have to cycle, one by one, over all the bytes received looking for the token elements (see code below)?

Code:
       'Get data from port 4001
        Dim buffer() As Byte = UDPLocation.EndReceive(ar, EndPoint)

        Dim Message As String
        While buffer.Length > 0
            'Document Identifier
            Select Case buffer(0)
                Case &H07
                    'Immediate Location Report
                    Message = "Immediate Location Report"
            End Select
            'Length in Byte 1
            Dim l As Integer = CInt(buffer(1)) + 2
            'New array with entire mbxml document
            Dim Data(l - 1) As Byte
            Array.Copy(buffer, 0, Data, 0, l)
            'Delete from buffer mbxml document
            Array.Copy(buffer, l, buffer, 0, buffer.Length - l)
            ReDim Preserve buffer(buffer.Length - l - 1)
            'cursor to cycle inside the byte array Data
            Dim i As Integer = 2
            'Cycle until the array is empty
            While i < UBound(Data)
                'looking for token
                Select Case Data(i)
                    Case &H22
                        'request-id token: length in the next byte
                        l = CInt(Data(i + 1))
                        Message &= " - request-id: " & CInt("&H" & BitConverter.ToString(Data, i + 2, l).Replace("-", "")).ToString
                        i = i + 2 + l
                        
                        [...]

                    Case Else
                        'Error; invalid token
                        Message = "ERRORE: BYTE " & i.ToString & " del pacchetto " & BitConverter.ToString(Data, 0, Data.Length) & " invalid token"
                        Exit While
                End Select
            End While
            'Print the results
            If Not Message Is Nothing Then RaiseEvent ShowMessage(Format(Date.Now, "dd/MM/yyyy HH:mm:ss") & " - " & EndPoint.Address.ToString & " - " & Message)
        End While

Thank you in advance
Regards
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Home    Forum | Downloads | About us | Services  | Products | Online Portal | Site Map | Contact Us

Copyright 2008-2010 Motorola Radio Support Group. All Rights Reserved.

Google PageRank
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Sitemap Valid XHTML 1.0! Valid CSS!
Page created in 0.034 seconds with 22 queries.

Google visited last this page June 10, 2019, 02:57:29 PM