final EditText edit_command_id = alertView.findViewById(R.id.edit_command_id);
final EditText edit_message_body1 = alertView.findViewById(R.id.edit_message_body1);
final EditText edit_message_body2 = alertView.findViewById(R.id.edit_message_body2);
+ final EditText edit_message_body3 = alertView.findViewById(R.id.edit_message_body3);
+ final EditText edit_message_body4 = alertView.findViewById(R.id.edit_message_body4);
final Spinner selection_command_id = alertView.findViewById(R.id.spinner_selection_command_id);
final Spinner selection_message_type = alertView.findViewById(R.id.spinner_selection_message_type);
final Spinner selection_message_body_length = alertView.findViewById(R.id.spinner_selection_message_body_length);
int id = parseInt(edit_command_id);
int value1 = parseInt(edit_message_body1);
int value2 = parseInt(edit_message_body2);
+ int value3 = parseInt(edit_message_body3);
+ int value4 = parseInt(edit_message_body4);
if (selectedMessageTypePosition == 0)
{
- // single
+ // single type
if (selectedBodyLengthPosition == 0)
{
commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id));
}
+ else if (selectedBodyLengthPosition == 5)
+ {
+ commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 16, value1, value2, value3, value4));
+ }
+ else if (selectedBodyLengthPosition == 4)
+ {
+ commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 12, value1, value2, value3));
+ }
else if (selectedBodyLengthPosition == 3)
{
commandPublisher.enqueueCommand(new CommandGeneric(responseReceiver, id, 8, value1, value2));
}
else
{
- // multi
+ // multi type
if (selectedBodyLengthPosition == 0)
{
commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id));
}
+ else if (selectedBodyLengthPosition == 5)
+ {
+ commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 16, value1, value2, value3, value4));
+ }
+ else if (selectedBodyLengthPosition == 4)
+ {
+ commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 12, value1, value2, value3));
+ }
else if (selectedBodyLengthPosition == 3)
{
commandPublisher.enqueueCommand(new SetPropertyValue(responseReceiver, id, 8, value1, value2));
adapter.add("2");
adapter.add("4");
adapter.add("8");
+ adapter.add("12");
+ adapter.add("16");
spinner.setAdapter(adapter);
spinner.setSelection(selectedBodyLengthPosition);
private final byte data5;
private final byte data6;
private final byte data7;
+ private final byte data8;
+ private final byte data9;
+ private final byte dataA;
+ private final byte dataB;
+ private final byte dataC;
+ private final byte dataD;
+ private final byte dataE;
+ private final byte dataF;
public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id)
{
data5 = 0;
data6 = 0;
data7 = 0;
+
+ data8 = 0;
+ data9 = 0;
+ dataA = 0;
+ dataB = 0;
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
}
public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
data5 = ((byte)((0x0000ff00 & value) >> 8));
data6 = ((byte)((0x00ff0000 & value) >> 16));
data7 = ((byte)((0xff000000 & value) >> 24));
+
+ data8 = 0;
+ data9 = 0;
+ dataA = 0;
+ dataB = 0;
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
}
public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
data5 = ((byte)((0x0000ff00 & value2) >> 8));
data6 = ((byte)((0x00ff0000 & value2) >> 16));
data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = 0;
+ data9 = 0;
+ dataA = 0;
+ dataB = 0;
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
+ }
+
+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = ((byte) (0x000000ff & value3));
+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
+ dataB = ((byte)((0xff000000 & value3) >> 24));
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
+ }
+
+ public CommandGeneric(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3, int value4)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = ((byte) (0x000000ff & value3));
+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
+ dataB = ((byte)((0xff000000 & value3) >> 24));
+
+ dataC = ((byte) (0x000000ff & value4));
+ dataD = ((byte)((0x0000ff00 & value4) >> 8));
+ dataE = ((byte)((0x00ff0000 & value4) >> 16));
+ dataF = ((byte)((0xff000000 & value4) >> 24));
}
data0, data1, data2, data3, data4, data5, data6, data7,
});
}
- else // ボディ長が 2, 4, 8 以外の場合...
+ else if (bodySize == 12)
+ {
+ return (new byte[]{
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x01, (byte) 0x00,
+
+ // message_header.type
+ id0, id1,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // data ...
+ data0, data1, data2, data3, data4, data5, data6, data7,
+ data8, data9, dataA, dataB,
+ });
+ }
+ else if (bodySize == 16)
+ {
+ return (new byte[]{
+
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x01, (byte) 0x00,
+
+ // message_header.type
+ id0, id1,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // data ...
+ data0, data1, data2, data3, data4, data5, data6, data7,
+ data8, data9, dataA, dataB, dataC, dataD, dataE, dataF,
+ });
+ }
+ else // ボディ長が 2, 4, 8, 12, 16 以外の場合...
{
return (new byte[]{
private final byte data5;
private final byte data6;
private final byte data7;
+ private final byte data8;
+ private final byte data9;
+ private final byte dataA;
+ private final byte dataB;
+ private final byte dataC;
+ private final byte dataD;
+ private final byte dataE;
+ private final byte dataF;
public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id)
{
data5 = 0;
data6 = 0;
data7 = 0;
+
+ data8 = 0;
+ data9 = 0;
+ dataA = 0;
+ dataB = 0;
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
}
public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value)
data5 = ((byte)((0x0000ff00 & value) >> 8));
data6 = ((byte)((0x00ff0000 & value) >> 16));
data7 = ((byte)((0xff000000 & value) >> 24));
+
+ data8 = 0;
+ data9 = 0;
+ dataA = 0;
+ dataB = 0;
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
}
public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2)
data5 = ((byte)((0x0000ff00 & value2) >> 8));
data6 = ((byte)((0x00ff0000 & value2) >> 16));
data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = 0;
+ data9 = 0;
+ dataA = 0;
+ dataB = 0;
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
+ }
+
+
+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = ((byte) (0x000000ff & value3));
+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
+ dataB = ((byte)((0xff000000 & value3) >> 24));
+
+ dataC = 0;
+ dataD = 0;
+ dataE = 0;
+ dataF = 0;
+ }
+
+ public SetPropertyValue(@NonNull IFujiXCommandCallback callback, int id, int bodySize, int value, int value2, int value3, int value4)
+ {
+ this.callback = callback;
+ this.bodySize = bodySize;
+
+ id0 = ((byte) (0x000000ff & id));
+ id1 = ((byte)((0x0000ff00 & id) >> 8));
+
+ data0 = ((byte) (0x000000ff & value));
+ data1 = ((byte)((0x0000ff00 & value) >> 8));
+ data2 = ((byte)((0x00ff0000 & value) >> 16));
+ data3 = ((byte)((0xff000000 & value) >> 24));
+
+ data4 = ((byte) (0x000000ff & value2));
+ data5 = ((byte)((0x0000ff00 & value2) >> 8));
+ data6 = ((byte)((0x00ff0000 & value2) >> 16));
+ data7 = ((byte)((0xff000000 & value2) >> 24));
+
+ data8 = ((byte) (0x000000ff & value3));
+ data9 = ((byte)((0x0000ff00 & value3) >> 8));
+ dataA = ((byte)((0x00ff0000 & value3) >> 16));
+ dataB = ((byte)((0xff000000 & value3) >> 24));
+
+ dataC = ((byte) (0x000000ff & value4));
+ dataD = ((byte)((0x0000ff00 & value4) >> 8));
+ dataE = ((byte)((0x00ff0000 & value4) >> 16));
+ dataF = ((byte)((0xff000000 & value4) >> 24));
}
data0, data1, data2, data3, data4, data5, data6, data7
});
}
- else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
+ else if (bodySize == 12)
+ {
+ return (new byte[]{
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x02, (byte) 0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte) 0x16, (byte) 0x10,
+
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // ...data...
+ data0, data1, data2, data3, data4, data5, data6, data7,
+ data8, data9, dataA, dataB,
+ });
+ }
+ else if (bodySize == 16)
{
return (new byte[]{
// message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
// sequence number
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+
+ // ...data...
+ data0, data1, data2, data3, data4, data5, data6, data7,
+ data8, data9, dataA, dataB, dataC, dataD, dataE, dataF,
});
}
+ else // その他... (ボディ長の指定が 2, 4, 8 以外の場合は ボディ長なし としてしまう)
+ {
+ return (new byte[]{
+ // message_header.index : uint16 (0: terminate, 2: two_part_message, 1: other)
+ (byte) 0x02, (byte) 0x00,
+
+ // message_header.type : two_part (0x1016)
+ (byte) 0x16, (byte) 0x10,
+ // sequence number
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ });
+ }
}
@Override
android:hint="@string/dialog_message_body2_hint"
/>
+ <EditText android:id="@+id/edit_message_body3"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:autoLink="all"
+ android:linksClickable="true"
+ android:inputType="text"
+ android:hint="@string/dialog_message_body3_hint"
+ />
+
+ <EditText android:id="@+id/edit_message_body4"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:autoLink="all"
+ android:linksClickable="true"
+ android:inputType="text"
+ android:hint="@string/dialog_message_body4_hint"
+ />
+
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/dialog_message_body2_hint"
/>
+ <EditText android:id="@+id/edit_message_body3"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:autoLink="all"
+ android:linksClickable="true"
+ android:inputType="text"
+ android:hint="@string/dialog_message_body3_hint"
+ />
+
+ <EditText android:id="@+id/edit_message_body4"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:autoLink="all"
+ android:linksClickable="true"
+ android:inputType="text"
+ android:hint="@string/dialog_message_body4_hint"
+ />
+
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"