Class: RCS::CELL_Position

Inherits:
Object
  • Object
show all
Defined in:
lib/rcs-common/evidence/position.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#advObject (readonly)

Returns the value of attribute adv.



255
256
257
# File 'lib/rcs-common/evidence/position.rb', line 255

def adv
  @adv
end

#cidObject (readonly)

Returns the value of attribute cid.



255
256
257
# File 'lib/rcs-common/evidence/position.rb', line 255

def cid
  @cid
end

#dbObject (readonly)

Returns the value of attribute db.



255
256
257
# File 'lib/rcs-common/evidence/position.rb', line 255

def db
  @db
end

#lacObject (readonly)

Returns the value of attribute lac.



255
256
257
# File 'lib/rcs-common/evidence/position.rb', line 255

def lac
  @lac
end

#mccObject (readonly)

Returns the value of attribute mcc.



255
256
257
# File 'lib/rcs-common/evidence/position.rb', line 255

def mcc
  @mcc
end

#mncObject (readonly)

Returns the value of attribute mnc.



255
256
257
# File 'lib/rcs-common/evidence/position.rb', line 255

def mnc
  @mnc
end

Class Method Details

.sizeObject



257
258
259
# File 'lib/rcs-common/evidence/position.rb', line 257

def self.size
  self.struct(0,0,0,0,0,0).bytesize
end

.struct(mcc, mnc, lac, cid, db, adv) ⇒ Object



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/rcs-common/evidence/position.rb', line 261

def self.struct(mcc, mnc, lac, cid, db, adv)
  str = ''
  str += [0].pack('l')    # DWORD cbSize;                       // @field structure size in bytes
  str += [0].pack('l')    # DWORD dwParams;                     // @field indicates valid parameters
  str += [mcc].pack('l')  # DWORD dwMobileCountryCode;          // @field TBD
  str += [mnc].pack('l')  # DWORD dwMobileNetworkCode;          // @field TBD
  str += [lac].pack('l')  # DWORD dwLocationAreaCode;           // @field TBD
  str += [cid].pack('l')  # DWORD dwCellID;                     // @field TBD
  str += [0].pack('l')    # DWORD dwBaseStationID;              // @field TBD
  str += [0].pack('l')    # DWORD dwBroadcastControlChannel;    // @field TBD
  str += [db].pack('l')   # DWORD dwRxLevel;                    // @field Value from 0-63 (see GSM 05.08, 8.1.4)
  str += [0].pack('l')    # DWORD dwRxLevelFull;                // @field Value from 0-63 (see GSM 05.08, 8.1.4)
  str += [0].pack('l')    # DWORD dwRxLevelSub;                 // @field Value from 0-63 (see GSM 05.08, 8.1.4)
  str += [0].pack('l')    # DWORD dwRxQuality;                  // @field Value from 0-7  (see GSM 05.08, 8.2.4)
  str += [0].pack('l')    # DWORD dwRxQualityFull;              // @field Value from 0-7  (see GSM 05.08, 8.2.4)
  str += [0].pack('l')    # DWORD dwRxQualitySub;               // @field Value from 0-7  (see GSM 05.08, 8.2.4)
  str += [0].pack('l')    # DWORD dwIdleTimeSlot;               // @field TBD
  str += [adv].pack('l')  # DWORD dwTimingAdvance;              // @field TBD
  str += [0].pack('l')    # DWORD dwGPRSCellID;                 // @field TBD
  str += [0].pack('l')    # DWORD dwGPRSBaseStationID;          // @field TBD
  str += [0].pack('l')    # DWORD dwNumBCCH;                    // @field TBD
  str += Array.new(48,0).pack('C*')  # BYTE rgbBCCH[MAXLENGTH_BCCH];       // @field TBD
  str += Array.new(16,0).pack('C*')  # BYTE rgbNMR[MAXLENGTH_NMR];         // @field TBD
  return str  
end

Instance Method Details

#read(stream) ⇒ Object



287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/rcs-common/evidence/position.rb', line 287

def read(stream)
  stream.read(2*4) #size/params
  @mcc = stream.read(4).unpack('l').first
  @mnc = stream.read(4).unpack('l').first
  @lac = stream.read(4).unpack('l').first
  @cid = stream.read(4).unpack('l').first
  stream.read(2*4) # basestationid/broadcastcontrolchannel
  @db = stream.read(4).unpack('l').first # rxlevel
  stream.read(6*4) #rxlevelfull/rxlevelsub/rxquality/rxqualityfull/rxqualitysub/idletimeslot
  @adv = stream.read(4).unpack('l').first # timingadvance
  stream.read(3*4) # gprscellid / gprsbasestationid / dwnumbcch
  stream.read(48+16) # BCCH[48] / NMR[16]
end