iOS Question iBLE question

Discussion in 'iOS Questions' started by megaB4x, Jun 18, 2015.

  1. megaB4x

    megaB4x Member Licensed User

    Hi,

    I have three characteristics and all three values are all displayed whenever I read only one char or on Notify event.

    How can I filter to log the value of a specific characteristic?

    For example:

    Code:
    Sub Manager_DataAvailable (Service As String, Characteristics As Map)
    Dim ch = "H01383AB-493A-7160-0123-84ABE4AABD12" As String
        
    For Each id As String In Characteristics.Keys
                 
    'Pseudocode - not sure how to filter to a single uuid
                 If Characteristics.uuid = ch then
                 
    Log(Characteristics.Get(id))
                 
    end if    
        
    Next
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The id is the key. If you are only interested in a single characteristic then you don't need the For Each loop.

    Code:
    Dim data() As Byte = Characteristics.Get(ch)
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    dataN is an array. You cannot treat as a number. Change dataN to dataN.Length if you want to check the array length.

    You do not need to clear the array. As it is a local variable it will be cleared automatically when the sub ends.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I'm not sure that I understand the problem. Sorry.
     
Loading...