Class: Majoron::AntHill::SMPP::BroadcastAreaIdentifier

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

Overview

Class describe broadcast area identifier

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = "") ⇒ BroadcastAreaIdentifier

Constructor.



24
25
26
# File 'lib/smpp_datatypes.rb', line 24

def initialize(value = "")
	@value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



85
86
87
# File 'lib/smpp_datatypes.rb', line 85

def value
  @value
end

Instance Method Details

#alias?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/smpp_datatypes.rb', line 28

def alias?()
	return false if @value.size() == 0
     if RUBY_VERSION >= "1.9.0"
       # Encoding::CompatibilityError: incompatible character encodings: US-ASCII and ASCII-8BIT
       # ASCII-8BIT is a binary data, I am not able to find how to set encoding in constructor
       @value.force_encoding("ASCII-8BIT")
       return value[0].ord == BroadcastAreaFormat::ALIAS
     else
       return value[0] == BroadcastAreaFormat::ALIAS
     end
end

#broadcast_area_formatObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/smpp_datatypes.rb', line 64

def broadcast_area_format()
	BroadcastAreaFormat::UNKNOWN if @value.size() == 0
     if RUBY_VERSION >= "1.9.0"
       # Encoding::CompatibilityError: incompatible character encodings: US-ASCII and ASCII-8BIT
       # ASCII-8BIT is a binary data, I am not able to find how to set encoding in constructor
       @value.force_encoding("ASCII-8BIT")
       if value[0].ord == BroadcastAreaFormat::ALIAS ||
         value[0].ord = BroadcastAreaFormat::ELLIPSOID ||
         value[0].ord = BroadcastAreaFormat::POLYGON
         return value[0].ord
       end
     else
       if value[0] == BroadcastAreaFormat::ALIAS ||
         value[0] = BroadcastAreaFormat::ELLIPSOID ||
         value[0] = BroadcastAreaFormat::POLYGON
         return value[0]
       end
     end
	return BroadcastAreaFormat::UNKNOWN
end

#ellipsoid?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/smpp_datatypes.rb', line 40

def ellipsoid?()
	return false if @value.size() == 0
     if RUBY_VERSION >= "1.9.0"
       # Encoding::CompatibilityError: incompatible character encodings: US-ASCII and ASCII-8BIT
       # ASCII-8BIT is a binary data, I am not able to find how to set encoding in constructor
       @value.force_encoding("ASCII-8BIT")
       return value[0].ord == BroadcastAreaFormat::ELLIPSOID
     else
       return value[0] == BroadcastAreaFormat::ELLIPSOID
     end
end

#polygon?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
61
62
# File 'lib/smpp_datatypes.rb', line 52

def polygon?()
	return false if @value.size() == 0
     if RUBY_VERSION >= "1.9.0"
       # Encoding::CompatibilityError: incompatible character encodings: US-ASCII and ASCII-8BIT
       # ASCII-8BIT is a binary data, I am not able to find how to set encoding in constructor
       @value.force_encoding("ASCII-8BIT")
       return value[0].ord == BroadcastAreaFormat::POLYGON
     else
       return value[0] == BroadcastAreaFormat::POLYGON
     end
end