Class: Rho::NdefMessage

Inherits:
Object show all
Defined in:
lib/extensions/nfc/nfc.rb

Instance Method Summary collapse

Instance Method Details

#get_byte_arrayObject

return raw byte[]



204
205
206
# File 'lib/extensions/nfc/nfc.rb', line 204

def get_byte_array
    return @byte_array
end

#get_recordsObject

return array of NdefRecord



209
210
211
# File 'lib/extensions/nfc/nfc.rb', line 209

def get_records
    return @records
end

#init_from_array_of_NdefRecord(array) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/extensions/nfc/nfc.rb', line 183

def init_from_array_of_NdefRecord(array)
    
    record_array = []
    
    i = 0
    
    while i < array.size do
        rec = array[i]
        
        record_array << rec.get_byte_array
    
        i = i+1
    end    
        
    msg_array = Nfc.convert_NdeRecords_array_to_NdeMessage_byte_array(record_array)   
        
    init_from_byte_array(msg_array)    
    
end

#init_from_byte_array(array) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/extensions/nfc/nfc.rb', line 161

def init_from_byte_array(array)
           
    @byte_array = array
    @records = []
    
    if array != nil 
    
        record_array = Nfc.convert_NdeMessage_byte_array_to_NdeRecords_array(@byte_array)
        i = 0
        while i < record_array.size do
            record_ba = record_array[i]
        
            rec = NdefRecord.new
            rec.init_from_byte_array(record_ba)
        
            @records << rec
        
            i = i+1
        end    
     end
end