Class: MsgNotifyEndComm

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

Overview

<summary> 通信終了通知メッセージ(0x01) </summary>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMsgNotifyEndComm

Returns a new instance of MsgNotifyEndComm.



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
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 10

def initialize()
    #region 変数・定数定義
    #メンバーIndex offset定義
    @INDEX_ID = 0              #メッセージID
    @INDEX_END_CODE = 1        #終了コード
    @INDEX_ERR_CODE = 2        #NGコード(異常時)
    @INDEX_PADDING = 3         #アライメント

    # <summary>
    # 送信メンバデータ値定義
    # </summary>
    #終了コード
    @END_CODE_OK = 0x00      #正常
    @END_CODE_NG = 0x01      #異常
    #NGコード(異常時)
    @ERR_CODE_NONE = 0x00                 #エラーなし(正常終了)
    @ERR_CODE_RCV_DATA = 0x01             #受信データエラー
    @ERR_CODE_OTHER_REASONS = 0x02        #その他原因によるエラー

    @id = MSG_NOTIFY_END_COMM             #メッセージID
    @end_code = 0x00                      #終了コード
    @err_code = 0x00                      #NGコード(異常時)
    @padding = Array.new(5, 0x00)         #アライメント
    @total_len = 8                        #送信フィールド合計サイズ
    #endregion
end

Instance Attribute Details

#end_codeObject

アクセサ定義



44
45
46
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 44

def end_code
  @end_code
end

#END_CODE_NGObject (readonly)

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



41
42
43
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 41

def END_CODE_NG
  @END_CODE_NG
end

#END_CODE_OKObject (readonly)

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



41
42
43
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 41

def END_CODE_OK
  @END_CODE_OK
end

#err_codeObject

アクセサ定義



44
45
46
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 44

def err_code
  @err_code
end

#ERR_CODE_NONEObject (readonly)

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



41
42
43
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 41

def ERR_CODE_NONE
  @ERR_CODE_NONE
end

#ERR_CODE_OTHER_REASONSObject (readonly)

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



41
42
43
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 41

def ERR_CODE_OTHER_REASONS
  @ERR_CODE_OTHER_REASONS
end

#ERR_CODE_RCV_DATAObject (readonly)

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



41
42
43
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 41

def ERR_CODE_RCV_DATA
  @ERR_CODE_RCV_DATA
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#INDEX_END_CODEObject (readonly)

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



38
39
40
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 38

def INDEX_END_CODE
  @INDEX_END_CODE
end

#INDEX_ERR_CODEObject (readonly)

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



38
39
40
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 38

def INDEX_ERR_CODE
  @INDEX_ERR_CODE
end

#INDEX_IDObject (readonly)

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



38
39
40
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 38

def INDEX_ID
  @INDEX_ID
end

#INDEX_PADDINGObject (readonly)

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



38
39
40
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 38

def INDEX_PADDING
  @INDEX_PADDING
end

#paddingObject

アクセサ定義



44
45
46
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 44

def padding
  @padding
end

#total_lenObject (readonly)

Returns the value of attribute total_len.



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

def total_len
  @total_len
end

Instance Method Details

#makeSendDataObject

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/haruzira_sdk/MsgNotifyEndComm.rb', line 52

def makeSendData()
    len = @total_len
    data = nil

    begin
        data = [@id] + [@end_code] + [@err_code] + @padding

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