Class: MsgReqStartComm
- Inherits:
-
Object
- Object
- MsgReqStartComm
- Defined in:
- lib/haruzira_sdk/MsgReqStartComm.rb
Overview
<summary> 通信開始要求メッセージ(0x00) </summary>
Instance Attribute Summary collapse
-
#cer_flg ⇒ Object
アクセサ定義.
-
#CER_FLG_OFF ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#CER_FLG_ON ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#enc_flg ⇒ Object
アクセサ定義.
-
#ENC_FLG_OFF ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#ENC_FLG_ON ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#head_len ⇒ Object
readonly
Returns the value of attribute head_len.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#INDEX_CER_FLG ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_ENC_FLG ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_ID ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_NAME ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_NAME_LEN ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_PADDING ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_PADDING2 ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_PASSWD_LEN ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_PORT ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#name ⇒ Object
アクセサ定義.
-
#name_len ⇒ Object
アクセサ定義.
-
#passwd ⇒ Object
アクセサ定義.
-
#passwd_len ⇒ Object
アクセサ定義.
-
#port ⇒ Object
アクセサ定義.
-
#total_len ⇒ Object
readonly
Returns the value of attribute total_len.
Instance Method Summary collapse
-
#initialize ⇒ MsgReqStartComm
constructor
A new instance of MsgReqStartComm.
-
#makeSendData ⇒ Object
<summary> 送信データ生成 </summary> <returns>生成データサイズ, 生成データ</returns>.
Constructor Details
#initialize ⇒ MsgReqStartComm
Returns a new instance of MsgReqStartComm.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 11 def initialize() #region 変数・定数定義 # <summary> # メンバーIndex offset定義 # </summary> @INDEX_ID = 0 #メッセージID @INDEX_ENC_FLG = 1 #暗号化フラグ @INDEX_CER_FLG = 2 #認証フラグ @INDEX_PADDING = 3 #アライメント @INDEX_PORT = 4 #ポート番号 @INDEX_NAME_LEN = 6 #接続元名称サイズ @INDEX_PASSWD_LEN = 8 #パスワードサイズ @INDEX_PADDING2 = 10 #アライメント @INDEX_NAME = 12 #接続元名称 #endregion # <summary> # 送信メンバデータ値定義 # </summary> #暗号化フラグ @ENC_FLG_OFF = 0x00 #暗号化無 @ENC_FLG_ON = 0x01 #暗号化有 #認証フラグ @CER_FLG_OFF = 0x00 #認証無 @CER_FLG_ON = 0x01 #認証有 @id = MSG_REQ_START_COMM #メッセージID @enc_flg = 0x00 #暗号化フラグ @cer_flg = 0x00 #認証フラグ @padding = 0x00 #アライメント @port = 46000 #ポート番号 @name_len = 0x00 #接続元名称サイズ @passwd_len = 0x00 #パスワードサイズ @padding2 = Array.new(2, 0x00) #アライメント @name = nil #接続元名称 @passwd = nil #パスワード #@byte[] reserve { get; set; } #予備 @head_len = (1 * 4) + (2 * 3) + @padding2.size #ヘッダーサイズ(読み上げデータを除いたサイズ) @total_len = 0 #送信フィールド合計サイズ end |
Instance Attribute Details
#cer_flg ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def cer_flg @cer_flg end |
#CER_FLG_OFF ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
56 57 58 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 56 def CER_FLG_OFF @CER_FLG_OFF end |
#CER_FLG_ON ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
56 57 58 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 56 def CER_FLG_ON @CER_FLG_ON end |
#enc_flg ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def enc_flg @enc_flg end |
#ENC_FLG_OFF ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
56 57 58 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 56 def ENC_FLG_OFF @ENC_FLG_OFF end |
#ENC_FLG_ON ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
56 57 58 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 56 def ENC_FLG_ON @ENC_FLG_ON end |
#head_len ⇒ Object (readonly)
Returns the value of attribute head_len.
60 61 62 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 60 def head_len @head_len end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
60 61 62 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 60 def id @id end |
#INDEX_CER_FLG ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_CER_FLG @INDEX_CER_FLG end |
#INDEX_ENC_FLG ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_ENC_FLG @INDEX_ENC_FLG end |
#INDEX_ID ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_ID @INDEX_ID end |
#INDEX_NAME ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_NAME @INDEX_NAME end |
#INDEX_NAME_LEN ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_NAME_LEN @INDEX_NAME_LEN end |
#INDEX_PADDING ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_PADDING @INDEX_PADDING end |
#INDEX_PADDING2 ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_PADDING2 @INDEX_PADDING2 end |
#INDEX_PASSWD_LEN ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_PASSWD_LEN @INDEX_PASSWD_LEN end |
#INDEX_PORT ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
53 54 55 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 53 def INDEX_PORT @INDEX_PORT end |
#name ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def name @name end |
#name_len ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def name_len @name_len end |
#passwd ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def passwd @passwd end |
#passwd_len ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def passwd_len @passwd_len end |
#port ⇒ Object
アクセサ定義
59 60 61 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 59 def port @port end |
#total_len ⇒ Object (readonly)
Returns the value of attribute total_len.
60 61 62 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 60 def total_len @total_len end |
Instance Method Details
#makeSendData ⇒ Object
<summary> 送信データ生成</summary> <returns>生成データサイズ, 生成データ</returns>
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/haruzira_sdk/MsgReqStartComm.rb', line 67 def makeSendData() @total_len = @head_len + (@name_len + @passwd_len); data = nil begin #パスワードとアカウント名のチェック if(@name_len > 0 && @name == nil) return 0, nil end if(@passwd_len > 0 && @passwd == nil) return 0, nil end #ネットワークバイトオーダー(little -> big)変換後に、Byte配列に変換 bPort = [port].pack("n*").unpack("C*") bUserLen = [name_len].pack("n*").unpack("C*") bPasswdLen = [passwd_len].pack("n*").unpack("C*") if(@name != nil && @passwd != nil) data = [@id] + [@enc_flg] + [@cer_flg] + [@padding] + bPort + bUserLen + bPasswdLen + @padding2 + @name + @passwd else data = [@id] + [@enc_flg] + [@cer_flg] + [@padding] + bPort + bUserLen + bPasswdLen + @padding2 end rescue Exception => ex p ex @total_len = 0 ensure return @total_len, data end end |