Class: PduSms::ServiceCenterTimeStamp

Inherits:
Object
  • Object
show all
Defined in:
lib/pdu_sms/service_center_time_stamp.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, data) ⇒ ServiceCenterTimeStamp

Returns a new instance of ServiceCenterTimeStamp.



7
8
9
10
11
12
13
14
15
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 7

def initialize(type, data)
  if type == :encode_sc
    @scts = _absolute_timestamp data
  elsif type == :decode_sc
    @scts = data
  else
    raise ArgumentError, 'The "type" is incorrect'
  end
end

Class Method Details

.cut_off_pdu(pdu, part = :all, type = :sс) ⇒ Object

tail current

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 26

def ServiceCenterTimeStamp.cut_off_pdu(pdu, part=:all, type=:s

.decode_sc(pdu_str) ⇒ Object



21
22
23
24
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 21

def ServiceCenterTimeStamp.decode_sc(pdu_str)
  scts = ServiceCenterTimeStamp.cut_off_pdu(pdu_str, part=:current, :s

.encode_sc(times) ⇒ Object



17
18
19
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 17

def ServiceCenterTimeStamp.encode_sc(times)
  new(:encode_sc, times).freeze
end

Instance Method Details

#get_hexObject



38
39
40
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 38

def get_hex
  @scts
end

#get_timeObject



42
43
44
# File 'lib/pdu_sms/service_center_time_stamp.rb', line 42

def get_time
  _absolute_pdu @scts
end