Class: MsgNotifyStopComm

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

Overview

<summary> 通信停止通知メッセージ(0x11) </summary>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMsgNotifyStopComm

Returns a new instance of MsgNotifyStopComm.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 10

def initialize()
    #region 変数・定数定義
    #メンバーIndex offset定義
    @INDEX_ID = 0              #メッセージID
    @INDEX_STOP_CODE = 1       #停止コード
    @INDEX_REASON_CODE = 2     #停止理由コード
    @INDEX_PADDING = 3         #アライメント


    # <summary>
    # 送信メンバデータ値定義
    # </summary>
    #応答コード
    @STOP_CODE_OK = 0x00                  #正常
    @STOP_CODE_NG = 0x01                  #異常
    #停止理由コード
    @REASON_CODE_NONE = 0x00              #通常停止
    @REASON_CODE_MAINTENANCE = 0x01       #メンテナンス(一時的な停止)
    @REASON_CODE_FAILURE = 0x02           #障害発生(恒久的な停止、復旧スケジュールが不明の場合など)

    @id = MSG_NOTIFY_STOP_COMM          #メッセージID
    @stop_code = 0x00                   #停止コード
    @reason_code = 0x00                 #停止理由コード
    @padding = Array.new(5, 0x00)       #アライメント
    @total_len = 8                      #送信フィールド合計サイズ
    #endregion
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



46
47
48
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 46

def id
  @id
end

#INDEX_IDObject (readonly)

アクセサ定義(メンバーIndex offset)



39
40
41
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 39

def INDEX_ID
  @INDEX_ID
end

#INDEX_PADDINGObject (readonly)

アクセサ定義(メンバーIndex offset)



39
40
41
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 39

def INDEX_PADDING
  @INDEX_PADDING
end

#INDEX_REASON_CODEObject (readonly)

アクセサ定義(メンバーIndex offset)



39
40
41
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 39

def INDEX_REASON_CODE
  @INDEX_REASON_CODE
end

#INDEX_STOP_CODEObject (readonly)

アクセサ定義(メンバーIndex offset)



39
40
41
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 39

def INDEX_STOP_CODE
  @INDEX_STOP_CODE
end

#paddingObject

アクセサ定義



45
46
47
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 45

def padding
  @padding
end

#reason_codeObject

アクセサ定義



45
46
47
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 45

def reason_code
  @reason_code
end

#REASON_CODE_FAILUREObject (readonly)

アクセサ定義(送信メンバデータ値)



42
43
44
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 42

def REASON_CODE_FAILURE
  @REASON_CODE_FAILURE
end

#REASON_CODE_MAINTENANCEObject (readonly)

アクセサ定義(送信メンバデータ値)



42
43
44
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 42

def REASON_CODE_MAINTENANCE
  @REASON_CODE_MAINTENANCE
end

#REASON_CODE_NONEObject (readonly)

アクセサ定義(送信メンバデータ値)



42
43
44
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 42

def REASON_CODE_NONE
  @REASON_CODE_NONE
end

#stop_codeObject

アクセサ定義



45
46
47
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 45

def stop_code
  @stop_code
end

#STOP_CODE_NGObject (readonly)

アクセサ定義(送信メンバデータ値)



42
43
44
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 42

def STOP_CODE_NG
  @STOP_CODE_NG
end

#STOP_CODE_OKObject (readonly)

アクセサ定義(送信メンバデータ値)



42
43
44
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 42

def STOP_CODE_OK
  @STOP_CODE_OK
end

#total_lenObject (readonly)

Returns the value of attribute total_len.



46
47
48
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 46

def total_len
  @total_len
end

Instance Method Details

#makeSendDataObject

<summary> 送信データ生成</summary> <returns>生成データサイズ, 生成データ</returns>



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/haruzira_sdk/MsgNotifyStopComm.rb', line 55

def makeSendData()
    len = @total_len
    data = nil

    begin
        data = [@id] + [@stop_code] + [@reason_code] + @padding

    rescue Exception => ex
        p ex
        len = 0
    ensure
        return len, data
    end
end