start to include flash channel (with error to debug)

This commit is contained in:
Daniel Pollithy 2018-01-26 04:24:23 +01:00
parent 1f4de84689
commit a1698cb4fb
11 changed files with 178 additions and 86 deletions

View File

@ -21,6 +21,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import java.net.InetAddress;
@ -79,6 +80,16 @@ public class HotspotFragment extends Fragment {
final View activity_view = getActivity().findViewById(R.id.drawer_layout);
}
String what = intent.getStringExtra("what");
String message = intent.getStringExtra("message");
if (message != null && message.equals("error")) {
String snd_message = intent.getStringExtra("snd_message");
Toast.makeText(getContext(), snd_message, Toast.LENGTH_SHORT).show();
}
}
@Override

View File

@ -141,21 +141,6 @@ public class MainActivity extends AppCompatActivity
}
private void initUi() {
/*final Switch switch_ = (Switch) findViewById(R.id.wifiSwitch);
switch_.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (!mBound) {
switch_.setChecked(false);
Toast.makeText(getApplicationContext(), "Wifi Broadcast not bound", Toast.LENGTH_SHORT).show();
} else {
mService.enableService();
}
} else {
mService.disableService();
}
}
});*/
}
private String readFile(String name) {

View File

@ -114,6 +114,11 @@ public class SearchFragment extends Fragment {
if (message != null && message.equals("error")) {
String snd_message = intent.getStringExtra("snd_message");
Snackbar.make(view, snd_message, Snackbar.LENGTH_LONG).setAction("Action", null).show();
if (getmService() != null) {
getmService().setBusy(false);
}
PeerStore.getInstance().clear();
updateList();
}
}

View File

@ -9,6 +9,9 @@ import android.util.Log;
import com.flashwifi.wifip2p.datastore.PeerInformation;
import com.flashwifi.wifip2p.datastore.PeerStore;
import com.flashwifi.wifip2p.iotaFlashWrapper.*;
import com.flashwifi.wifip2p.iotaFlashWrapper.FlashChannelHelper;
import com.flashwifi.wifip2p.iotaFlashWrapper.Model.Digest;
import com.flashwifi.wifip2p.negotiation.SocketWrapper;
import com.flashwifi.wifip2p.protocol.BillMessage;
import com.flashwifi.wifip2p.protocol.BillMessageAnswer;
@ -28,7 +31,9 @@ import java.net.NetworkInterface;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import static android.content.Context.WIFI_SERVICE;
@ -44,6 +49,8 @@ public class BillingClient {
private static final String TAG = "BillingClient";
private final Gson gson;
private final String mac;
private final String seed;
private final int seedindex;
private State state = State.NOT_PAIRED;
private Socket socket;
private SocketWrapper socketWrapper;
@ -55,6 +62,8 @@ public class BillingClient {
private BillingOpenChannelAnswer billingOpenChannelAnswer;
private BillMessage[] billMessages;
FlashChannelHelper one;
Context context;
private void sendUpdateUIBroadcastWithMessage(String message){
@ -64,10 +73,12 @@ public class BillingClient {
context.sendBroadcast(local);
}
public BillingClient(String mac, Context context){
public BillingClient(String mac, Context context, String seed, int seedindex){
this.context = context;
this.mac = mac;
gson = new GsonBuilder().create();
this.seed = seed;
this.seedindex = seedindex;
}
@ -114,25 +125,61 @@ public class BillingClient {
NegotiationOfferAnswer answer = PeerStore.getInstance().getLatestNegotiationOfferAnswer(mac);
NegotiationFinalization finalization = PeerStore.getInstance().getLatestFinalization(mac);
// ToDo: replace magic number with setting
int totalMegabytes = 100;
int treeDepth = 8;
String[] digests = new String[]{"1234", "2345", "3456"};
int timeoutMinutesClient = 20 * 60 * 1000;
int iotaPerMegabyte = offer.getIotaPerMegabyte();
String clientRefundAddress = finalization.getClientRefundAddress();
//String clientRefundAddress = finalization.getClientRefundAddress();
int totalMinutes = answer.getDuranceInMinutes();
billingOpenChannel = new BillingOpenChannel(totalMegabytes, iotaPerMegabyte, clientRefundAddress, treeDepth, digests, timeoutMinutesClient, totalMinutes);
// the deposit of one party
int iotaDeposit = Accountant.getInstance().getTotalIotaDeposit();
int totalMegabytes = totalMinutes; // assumption 1MB per minute
int treeDepth = com.flashwifi.wifip2p.iotaFlashWrapper.FlashChannelHelper.getRequiredDepth(10);
one = FlashChannelHelper.getInstance();
double[] deposits = new double[]{iotaDeposit, iotaDeposit};
// client is always userIndex==0
// ToDo: remove mocked data
String seed = "RDNUSLPNOQUGDIZVOINTYRIRRIJMLODOC9ZTQU9KQSCDXPVSBILXUE9AHEOA9MNYZWNSECAVPQ9QSAHCN";
one.setupUser(0, seed, seedindex, 1);
one.setupFlash(deposits, treeDepth);
// The addresses must be exchanged over the network.
// When done setup the settlementAddresses.
ArrayList<String> settlementAddresses = new ArrayList<>();
settlementAddresses.add(answer.getClientSettlementAddress());
settlementAddresses.add(finalization.getHotspotSettlementAddress());
// Set the addresses
one.setupSettlementAddresses(settlementAddresses);
List<Digest> initialDigestsOne = one.initialChannelDigests();
int timeoutMinutesClient = 20 * 60 * 1000;
billingOpenChannel = new BillingOpenChannel(totalMegabytes, iotaPerMegabyte, treeDepth, initialDigestsOne, timeoutMinutesClient, totalMinutes);
PeerStore.getInstance().setLatestBillingOpenChannel(mac, billingOpenChannel);
String billingOpenChannelString = gson.toJson(billingOpenChannel);
socketWrapper.sendLine(billingOpenChannelString);
// receive the hotspot details for the flash channel
String billingOpenChannelAnswerString = socketWrapper.getLineThrowing();
billingOpenChannelAnswer = gson.fromJson(billingOpenChannelAnswerString, BillingOpenChannelAnswer.class);
PeerStore.getInstance().setLatestBillingOpenChannelAnswer(mac, billingOpenChannelAnswer);
// now create the flash channel on our side
List<List<Digest>> digestPairs = new ArrayList<>();
digestPairs.add(initialDigestsOne);
digestPairs.add(billingOpenChannelAnswer.getHotspotDigests());
one.setupChannelWithDigests(digestPairs);
Log.d("[ROOT ADDR]", one.getRootAddressWithChecksum());
// assert that the root address of both parties are the same
if (one.getRootAddressWithChecksum().equals(billingOpenChannelAnswer.getChannelRootAddress())) {
Log.d(TAG, "start: HOOOORAY! The multisig addresses match!");
} else {
Log.d(TAG, "start: :( :( :( :( :( :( A day to cry. the multisig addresses don't match");
}
Accountant.getInstance().start(billingOpenChannel.getTotalMegabytes(), billingOpenChannel.getTimeoutMinutesClient(), billingOpenChannel.getTotalMinutes(), billingOpenChannelAnswer.getClientDepositIota(),
billingOpenChannel.getIotaPerMegabyte());
sendUpdateUIBroadcastWithMessage("Channel established");

View File

@ -12,6 +12,9 @@ import android.text.format.Formatter;
import android.util.Log;
import com.flashwifi.wifip2p.datastore.PeerStore;
import com.flashwifi.wifip2p.iotaFlashWrapper.*;
import com.flashwifi.wifip2p.iotaFlashWrapper.FlashChannelHelper;
import com.flashwifi.wifip2p.iotaFlashWrapper.Model.Digest;
import com.flashwifi.wifip2p.negotiation.SocketWrapper;
import com.flashwifi.wifip2p.protocol.BillMessage;
import com.flashwifi.wifip2p.protocol.BillMessageAnswer;
@ -32,7 +35,9 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import static android.content.Context.WIFI_SERVICE;
@ -49,15 +54,17 @@ public class BillingServer {
private static final String TAG = "BillingServer";
private final Gson gson;
private final String mac;
private final String hotspotRefundAddress;
private final String channelRootAddress;
private final String[] digests;
private final String seed;
private final int seedindex;
private State state = State.NOT_PAIRED;
private ServerSocket serverSocket;
private Socket socket;
private SocketWrapper socketWrapper;
private int PORT = 9199;
private static final int serverTimeoutMillis = 2 * 60 * 1000;
FlashChannelHelper two;
List<Digest> initialDigestsTwo;
Context context;
NetworkStatsManager networkStatsManager;
@ -69,9 +76,11 @@ public class BillingServer {
context.sendBroadcast(local);
}
public BillingServer(String mac, Context context){
public BillingServer(String mac, Context context, String seed, int seedindex){
this.context = context;
this.mac = mac;
this.seed = seed;
this.seedindex = seedindex;
Log.d(TAG, "BillingServer: MAC of other part: " + mac);
@ -80,22 +89,40 @@ public class BillingServer {
NegotiationOfferAnswer answer = PeerStore.getInstance().getLatestNegotiationOfferAnswer(mac);
NegotiationFinalization finalization = PeerStore.getInstance().getLatestFinalization(mac);
// get the necessary values
// ToDo: replace magic number with setting
int totalMegabytes = 100;
int treeDepth = 8;
this.digests = new String[]{"1234", "2345", "3456"};
int timeoutMinutesServer = 2 * 60 * 1000;
this.hotspotRefundAddress = finalization.getHotspotRefundAddress();
this.channelRootAddress = finalization.getDepositAddressFlashChannel();
int iotaPerMegabyte = offer.getIotaPerMegabyte();
int iotaDepositClient = totalMegabytes * iotaPerMegabyte;
String clientRefundAddress = finalization.getClientRefundAddress();
//String clientRefundAddress = finalization.getClientRefundAddress();
int totalMinutes = answer.getDuranceInMinutes();
Accountant.getInstance().start(totalMegabytes, timeoutMinutesServer, totalMinutes, iotaDepositClient, iotaPerMegabyte);
// the deposit of one party
int iotaDeposit = finalization.getDepositServerFlashChannelInIota();
int totalMegabytes = totalMinutes; // assumption 1MB per minute
int treeDepth = com.flashwifi.wifip2p.iotaFlashWrapper.FlashChannelHelper.getRequiredDepth(10);
two = com.flashwifi.wifip2p.iotaFlashWrapper.FlashChannelHelper.getInstance();
double[] deposits = new double[]{iotaDeposit, iotaDeposit};
// client is always userIndex==1
// ToDo: remove mock data
seed = "IUQDBHFDXK9EHKC9VUHCUXDLICLRANNDHYRMDYFCGSZMROWCZBLBNRKXWBSWZYDMLLHIHMP9ZPOPIFUSW";
two.setupUser(1, seed, seedindex, 1);
two.setupFlash(deposits, treeDepth);
// The addresses must be exchanged over the network.
// When done setup the settlementAddresses.
ArrayList<String> settlementAddresses = new ArrayList<>();
settlementAddresses.add(answer.getClientSettlementAddress());
settlementAddresses.add(finalization.getHotspotSettlementAddress());
two.setupSettlementAddresses(settlementAddresses);
initialDigestsTwo = two.initialChannelDigests();
int timeoutMinutesServer = 2 * 60 * 1000;
this.channelRootAddress = finalization.getDepositAddressFlashChannel();
Accountant.getInstance().start(totalMegabytes, timeoutMinutesServer, totalMinutes, iotaDeposit, iotaPerMegabyte);
gson = new GsonBuilder().create();
networkStatsManager = (NetworkStatsManager) context.getSystemService(Context.NETWORK_STATS_SERVICE);
}
@ -152,16 +179,21 @@ public class BillingServer {
PeerStore.getInstance().setLatestBillingOpenChannel(mac, billingOpenChannel);
// answer with billingOpenChannelAnswerString
// calculate ROOT ADDRESS
List<List<Digest>> digestPairs = new ArrayList<>();
digestPairs.add(billingOpenChannel.getClientDigests());
digestPairs.add(initialDigestsTwo);
// ToDo: create the flash channel
// This will create the initial multisig addresses and the root address.
two.setupChannelWithDigests(digestPairs);
Log.d("[ROOT ADDR]", two.getRootAddressWithChecksum());
BillingOpenChannelAnswer billingOpenChannelAnswer = new BillingOpenChannelAnswer(
Accountant.getInstance().getTotalIotaDeposit(),
Accountant.getInstance().getTotalIotaDeposit(),
hotspotRefundAddress,
channelRootAddress,
digests);
two.getRootAddressWithChecksum(),
initialDigestsTwo);
PeerStore.getInstance().setLatestBillingOpenChannelAnswer(mac, billingOpenChannelAnswer);
String billingOpenChannelAnswerString = gson.toJson(billingOpenChannelAnswer);
socketWrapper.sendLine(billingOpenChannelAnswerString);

View File

@ -372,7 +372,9 @@ public class WiFiDirectBroadcastService extends Service {
@Override
public void run() {
Log.d(TAG, "run: instantiate billing server");
BillingServer billingServer = new BillingServer(mac, getApplicationContext());
// ToDo: Replace seedindex
int seedindex = 0;
BillingServer billingServer = new BillingServer(mac, getApplicationContext(), seed, seedindex);
try {
billingServer.start();
@ -403,7 +405,7 @@ public class WiFiDirectBroadcastService extends Service {
Runnable task = new Runnable() {
@Override
public void run() {
BillingClient billingClient = new BillingClient(mac, getApplicationContext());
BillingClient billingClient = new BillingClient(mac, getApplicationContext(), seed, 0); // ToDo: remove the magic number
// Gget the AP gateway ip address
// https://stackoverflow.com/questions/9035784/how-to-know-ip-address-of-the-router-from-code-in-android
final WifiManager manager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
@ -683,6 +685,10 @@ public class WiFiDirectBroadcastService extends Service {
public void startNegotiationServer(final boolean isClient, String macAddress, String peerMac) {
// ToDo: settlementAddress
String settlementAddress = "RDNUSLPNOQUGDIZVOINTYRIRRIJMLODOC9ZTQU9KQSCDXPVSBILXUE9AHEOA9MNYZWNSECAVPQ9QSAHCN";
Runnable task = new Runnable() {
@Override
public void run() {
@ -691,7 +697,8 @@ public class WiFiDirectBroadcastService extends Service {
macAddress,
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()),
getBaseContext(),
peerMac
peerMac,
"IUQDBHFDXK9EHKC9VUHCUXDLICLRANNDHYRMDYFCGSZMROWCZBLBNRKXWBSWZYDMLLHIHMP9ZPOPIFUSW"// settlementAddress
);
String peer_mac_address = null;
@ -763,7 +770,7 @@ public class WiFiDirectBroadcastService extends Service {
this.sendBroadcast(local);
}
public void startNegotiationClient(final InetAddress address, final boolean isClient, String macAddress, String peerMacAddress) {
public void startNegotiationClient(final InetAddress address, final boolean isClient, String macAddress, String peerMacAddress, String settlementAddress) {
Runnable task = new Runnable() {
@Override
public void run() {
@ -772,7 +779,8 @@ public class WiFiDirectBroadcastService extends Service {
macAddress,
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()),
getBaseContext(),
peerMacAddress
peerMacAddress,
"RDNUSLPNOQUGDIZVOINTYRIRRIJMLODOC9ZTQU9KQSCDXPVSBILXUE9AHEOA9MNYZWNSECAVPQ9QSAHCN" //settlementAddress
);
String peer_mac_address = null;
boolean restartAfterwards = true;
@ -1229,7 +1237,9 @@ public class WiFiDirectBroadcastService extends Service {
startNegotiationServer(isInRoleConsumer(), ownerMac, clientMac);
} else {
InetAddress groupOwnerAddress = p2p_info.groupOwnerAddress;
startNegotiationClient(groupOwnerAddress, isInRoleConsumer(), clientMac, ownerMac);
// ToDo: get the settlementAddress
String settlementAddress = "RDNUSLPNOQUGDIZVOINTYRIRRIJMLODOC9ZTQU9KQSCDXPVSBILXUE9AHEOA9MNYZWNSECAVPQ9QSAHCN";
startNegotiationClient(groupOwnerAddress, isInRoleConsumer(), clientMac, ownerMac, settlementAddress);
}
}

View File

@ -32,6 +32,7 @@ public class Negotiator {
private static final int clientTimeoutMillis = 5000;
private static final int serverTimeoutMillis = 5000;
private final String peerMac;
private final String clientSettlementAddress;
private String ownMacAddress;
private SocketWrapper socketWrapper;
@ -83,13 +84,14 @@ public class Negotiator {
}
public Negotiator(boolean isConsumer, String ownMacAddress, SharedPreferences prefs, Context context,
String peerMac) {
String peerMac, String clientSettlementAddress) {
this.peerMac = peerMac;
this.isConsumer = isConsumer;
gson = new GsonBuilder().create();
this.ownMacAddress = ownMacAddress;
this.prefs = prefs;
this.context = context;
this.clientSettlementAddress = clientSettlementAddress;
Log.d(TAG, "Negotiator: " + ownMacAddress);
}
@ -274,6 +276,8 @@ public class Negotiator {
String defaultValue = "0";
String storedBalance = sharedPref.getString("balance", defaultValue);
int iotaBalance = Integer.parseInt(storedBalance);
// ToDo: remove the mock
iotaBalance = 100000;
Log.d(TAG, "runConsumerProtocol: MY IOTA BALANCE: " + iotaBalance);
@ -285,7 +289,7 @@ public class Negotiator {
}
// SEND NegotiationAnswer
NegotiationOfferAnswer answer = new NegotiationOfferAnswer(agree, client_roaming_minutes, ownMacAddress);
NegotiationOfferAnswer answer = new NegotiationOfferAnswer(agree, client_roaming_minutes, ownMacAddress, clientSettlementAddress);
PeerStore.getInstance().setLatestOfferAnswer(otherMac, answer);
String answerString = gson.toJson(answer);
socketWrapper.sendLine(answerString);
@ -342,6 +346,8 @@ public class Negotiator {
String defaultValue = "0";
String storedBalance = sharedPref.getString("balance", defaultValue);
int iotaBalance = Integer.parseInt(storedBalance);
// ToDo: remove the mock
iotaBalance = 100000;
// Assumption 1 MB per minute
if (iotaBalance < maxMinutes * iotaPerMegabyte) {
@ -404,14 +410,15 @@ public class Negotiator {
// ToDo: get depositAddressFlashChannel from SharedPreferences
// ToDo: get the bandwidth of the hotspot
// ToDo: create initial flash object
double bandwidth = 0.1; // megabyte per second;
double bandwidth = 1.0; // megabyte per second;
int max_data_volume_megabytes = (int) (answer.getDuranceInMinutes() * bandwidth);
int max_iota_transferred = max_data_volume_megabytes * offer.getIotaPerMegabyte();
max_iota_transferred = 10;
String rootAddress = "JZWUMRUEYFJOCDDRZCNIIMDZSX9LWMITNMDIAIUJKUV9LVDLSICDABFYTTBZFGEBJOADDN9WZ9IJJJD9DXRJRR9TOW";
String hotspotSettlementAddress = "IUQDBHFDXK9EHKC9VUHCUXDLICLRANNDHYRMDYFCGSZMROWCZBLBNRKXWBSWZYDMLLHIHMP9ZPOPIFUSW";
// send the most important message to the user
NegotiationFinalization finalization = new NegotiationFinalization(hotspotName, password,
rootAddress, max_iota_transferred, max_iota_transferred, "<flashObj>");
rootAddress, max_iota_transferred, max_iota_transferred, hotspotSettlementAddress);
PeerStore.getInstance().setLatestFinalization(otherMac, finalization);
String finalizationString = gson.toJson(finalization);

View File

@ -1,6 +1,10 @@
package com.flashwifi.wifip2p.protocol;
import com.flashwifi.wifip2p.iotaFlashWrapper.Model.Digest;
import java.util.List;
public class BillingOpenChannel {
private int totalMegabytes;
private int totalMinutes;
@ -8,10 +12,10 @@ public class BillingOpenChannel {
private int timeoutMinutesClient;
private String clientRefundAddress;
private int treeDepth;
private String[] clientDigests;
private List<Digest> clientDigests;
public BillingOpenChannel(int totalMegabytes, int iotaPerMegabyte, String clientRefundAddress,
int treeDepth, String[] clientDigests, int timeoutMinutesClient,
public BillingOpenChannel(int totalMegabytes, int iotaPerMegabyte,
int treeDepth, List<Digest> clientDigests, int timeoutMinutesClient,
int totalMinutes) {
this.totalMegabytes = totalMegabytes;
this.totalMinutes = totalMinutes;
@ -34,15 +38,12 @@ public class BillingOpenChannel {
return iotaPerMegabyte;
}
public String getClientRefundAddress() {
return clientRefundAddress;
}
public int getTreeDepth() {
return treeDepth;
}
public String[] getClientDigests() {
public List<Digest> getClientDigests() {
return clientDigests;
}

View File

@ -1,18 +1,20 @@
package com.flashwifi.wifip2p.protocol;
import com.flashwifi.wifip2p.iotaFlashWrapper.Model.Digest;
import java.util.List;
public class BillingOpenChannelAnswer {
private int hotspotDepositIota;
private int clientDepositIota;
private int timeoutMinutesHotspot;
private String hotspotRefundAddress;
private String channelRootAddress;
private String[] hotspotDigests;
private List<Digest> hotspotDigests;
public BillingOpenChannelAnswer(int hotspotDepositIota, int clientDepositIota, String hotspotRefundAddress, String channelRootAddress, String[] hotspotDigests) {
public BillingOpenChannelAnswer(int hotspotDepositIota, int clientDepositIota, String channelRootAddress, List<Digest> hotspotDigests) {
this.hotspotDepositIota = hotspotDepositIota;
this.clientDepositIota = clientDepositIota;
this.hotspotRefundAddress = hotspotRefundAddress;
this.channelRootAddress = channelRootAddress;
this.hotspotDigests = hotspotDigests;
}
@ -29,15 +31,11 @@ public class BillingOpenChannelAnswer {
return timeoutMinutesHotspot;
}
public String getHotspotRefundAddress() {
return hotspotRefundAddress;
}
public String getChannelRootAddress() {
return channelRootAddress;
}
public String[] getHotspotDigests() {
public List<Digest> getHotspotDigests() {
return hotspotDigests;
}
}

View File

@ -6,20 +6,18 @@ public class NegotiationFinalization {
private String hotspotName;
private String hotspotPassword;
private String depositAddressFlashChannel;
private String clientRefundAddress;
private String hotspotRefundAddress;
private String hotspotSettlementAddress;
private int depositServerFlashChannelInIota;
private int depositClientFlashChannelInIota;
private String flashObject;
public NegotiationFinalization(String hotspotName, String hotspotPassword, String depositAddressFlashChannel, int depositServerFlashChannelInIota, int depositClientFlashChannelInIota, String flashObject) {
public NegotiationFinalization(String hotspotName, String hotspotPassword, String depositAddressFlashChannel, int depositServerFlashChannelInIota, int depositClientFlashChannelInIota, String hotspotSettlementAddress) {
this.type = "negotiationFinalization";
this.hotspotName = hotspotName;
this.hotspotPassword = hotspotPassword;
this.depositAddressFlashChannel = depositAddressFlashChannel;
this.depositServerFlashChannelInIota = depositServerFlashChannelInIota;
this.depositClientFlashChannelInIota = depositClientFlashChannelInIota;
this.flashObject = flashObject;
this.hotspotSettlementAddress = hotspotSettlementAddress;
}
public String getHotspotName() {
@ -42,15 +40,7 @@ public class NegotiationFinalization {
return depositClientFlashChannelInIota;
}
public String getFlashObject() {
return flashObject;
}
public String getClientRefundAddress() {
return clientRefundAddress;
}
public String getHotspotRefundAddress() {
return hotspotRefundAddress;
public String getHotspotSettlementAddress() {
return hotspotSettlementAddress;
}
}

View File

@ -6,12 +6,14 @@ public class NegotiationOfferAnswer {
private boolean agreeToConditions;
private int duranceInMinutes;
private String consumerMac;
private String clientSettlementAddress;
public NegotiationOfferAnswer(boolean agreeToConditions, int duranceInMinutes, String consumerMac) {
public NegotiationOfferAnswer(boolean agreeToConditions, int duranceInMinutes, String consumerMac, String clientSettlementAddress) {
this.type = "answerToOffer";
this.agreeToConditions = agreeToConditions;
this.duranceInMinutes = duranceInMinutes;
this.consumerMac = consumerMac;
this.clientSettlementAddress = clientSettlementAddress;
}
public String getType() {
@ -29,4 +31,8 @@ public class NegotiationOfferAnswer {
public String getConsumerMac() {
return consumerMac;
}
public String getClientSettlementAddress() {
return clientSettlementAddress;
}
}