diff options
262 files changed, 2693 insertions, 889 deletions
diff --git a/.gitignore b/.gitignore index 041656ff8..f17e6ea57 100644 --- a/.gitignore +++ b/.gitignore @@ -308,3 +308,6 @@ __pycache__/ # ZBar binaries !/Software/External_Repositories/ZBar/bin + +# OpenCV binaries +!/Software/External_Repositories/OpenCV/bin diff --git a/Software/Android_Studio/ColorCapture/app/build.gradle b/Software/Android_Studio/ColorCapture/app/build.gradle index 9a9df5b1a..6f56df4f6 100644 --- a/Software/Android_Studio/ColorCapture/app/build.gradle +++ b/Software/Android_Studio/ColorCapture/app/build.gradle @@ -21,10 +21,20 @@ android { } } buildTypes { + + debug { + buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://192.168.1.86:45455/api/\"" + buildConfigField "String", "WEB_SERVICE_APP_ID", "\"Tdf793i4ughsiduf8749509237885ehgfdlkghlT\"" + } + release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + + buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://twinetcc.azurewebsites.net/api/\"" + buildConfigField "String", "WEB_SERVICE_APP_ID", "\"Tdf793i4ughsiduf8749509237885ehgfdlkghlT\"" } + } dataBinding { @@ -67,5 +77,9 @@ dependencies { annotationProcessor 'com.google.dagger:dagger-android-processor:2.11' annotationProcessor 'com.google.dagger:dagger-compiler:2.11' compile 'com.yanzhenjie.zbar:zbar:1.0.0' - implementation project(':onboarding') + compile 'com.squareup.retrofit2:retrofit:2.3.0' + compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' + compile 'com.squareup.retrofit2:converter-gson:2.1.0' + implementation 'com.github.yoanngoular:bitmapconverter:0.2.0' + } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml b/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml index f0e6277c9..a03d65975 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ package="com.twine.colorcapture"> <uses-permission android:name="android.permission.CAMERA" /> + <uses-permission android:name="android.permission.INTERNET" /> <uses-feature android:name="android.hardware.camera" @@ -25,13 +26,14 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="false" android:theme="@style/AppTheme"> - <activity android:name=".views.main.MainActivity"> + <activity android:name=".views.loading.LoadingActivity" android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + <activity android:name=".views.main.MainActivity"></activity> </application> </manifest>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/cpp/ColorCaptureLib/ColorCaptureLib.cpp b/Software/Android_Studio/ColorCapture/app/src/main/cpp/ColorCaptureLib/ColorCaptureLib.cpp index 3a97b4911..7437923f2 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/cpp/ColorCaptureLib/ColorCaptureLib.cpp +++ b/Software/Android_Studio/ColorCapture/app/src/main/cpp/ColorCaptureLib/ColorCaptureLib.cpp @@ -733,13 +733,14 @@ vector<Point> ColorCaptureLib::GetArcusVertices(Mat image) aruco::DetectorParameters* params = new aruco::DetectorParameters(); params->cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; params->perspectiveRemovePixelPerCell = 50; + params->minDistanceToBorder = 0; Ptr<aruco::Dictionary> dictionary = aruco::getPredefinedDictionary(aruco::DICT_4X4_50); aruco::detectMarkers(image, dictionary, corners, ids, &(*params)); if (corners.size() == 4) { - aruco::drawDetectedMarkers(image, corners, ids); + //aruco::drawDetectedMarkers(image, corners, ids); vertices = { diff --git a/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp b/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp index 62d702b7f..c2bee04e8 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp +++ b/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp @@ -8,47 +8,67 @@ using namespace cv; -enum RotateFlags { +enum RotateFlags +{ ROTATE_90DEG_CLOCKWISE = 0, //Rotate 90 degrees clockwise ROTATE_180DEG = 1, //Rotate 180 degrees clockwise ROTATE_90_DEFCOUNTERCLOCKWISEDEG = 2, //Rotate 270 degrees clockwise }; -void rot90(cv::Mat &matImage, int rotflag) { +void rot90(cv::Mat &matImage, int rotflag) +{ //1=CW, 2=CCW, 3=180 - if (rotflag == 1) { + if (rotflag == 1) + { transpose(matImage, matImage); flip(matImage, matImage, 1); //transpose+flip(1)=CW - } else if (rotflag == 2) { + } + else if (rotflag == 2) + { transpose(matImage, matImage); flip(matImage, matImage, 0); //transpose+flip(0)=CCW - } else if (rotflag == 3) { + } + else if (rotflag == 3) + { flip(matImage, matImage, -1); //flip(-1)=180 - } else if (rotflag != 0) { //if not 0,1,2,3: + } + else if (rotflag != 0) + { //if not 0,1,2,3: cout << "Unknown rotation flag(" << rotflag << ")" << endl; } } extern "C" JNIEXPORT jboolean JNICALL Java_com_twine_colorcapture_opencv_ImageProcessor_ProcessImage( - JNIEnv *env, jobject instance, jint frameWidth, - jint frameHeight, jint correctedWidth, jint correctedHeight, jbyteArray NV21FrameData, - jintArray outPixels, jintArray wrapedOutPixels) { - jbyte *pNV21FrameData = env->GetByteArrayElements(NV21FrameData, 0); - jint *poutPixels = env->GetIntArrayElements(outPixels, 0); - jint *pwrapedPixels = env->GetIntArrayElements(wrapedOutPixels, 0); + JNIEnv *env, + jobject instance, + jint frameWidth, + jint frameHeight, + jint sampleWidth, + jint sampleHeight, + jint histogramMethod, + jdouble similarityTolerance, + jboolean enableDoubleChecking, + jbyteArray frameData, + jintArray frameOutPixels, + jintArray sampleOutPixels) +{ + + jbyte *pFrameData = env->GetByteArrayElements(frameData, 0); + jint *pFrameOutPixels = env->GetIntArrayElements(frameOutPixels, 0); + jint *pSampleOutPixels = env->GetIntArrayElements(sampleOutPixels, 0); - //// jboolean has_result = jboolean(false); - try { + try + { ColorCaptureLib capture; Mat yuv(frameHeight + frameHeight / 2, frameWidth, CV_8UC1, - (unsigned char *) pNV21FrameData); + (unsigned char *) pFrameData); Mat rgb; - Mat result(frameWidth, frameHeight, CV_8UC4, (unsigned char *) poutPixels); + Mat result(frameWidth, frameHeight, CV_8UC4, (unsigned char *) pFrameOutPixels); cvtColor(yuv, rgb, COLOR_YUV2RGB_NV21); Mat gray; @@ -56,82 +76,65 @@ Java_com_twine_colorcapture_opencv_ImageProcessor_ProcessImage( cvtColor(rgb, gray, CV_RGB2GRAY); cv::Laplacian(gray, dst, CV_64F); - cv::Scalar mu, sigma; - cv::meanStdDev(dst, mu, sigma); - - double focusMeasure = sigma.val[0] * sigma.val[0]; +// cv::Scalar mu, sigma; +// cv::meanStdDev(dst, mu, sigma); - __android_log_print(ANDROID_LOG_ERROR, "FOCUS", "\n Focus measure is %f \n", focusMeasure); +// double focusMeasure = sigma.val[0] * sigma.val[0]; +// +// __android_log_print(ANDROID_LOG_ERROR, "FOCUS", "\n Focus measure is %f \n", focusMeasure); rot90(rgb, ROTATE_180DEG); - //resize(src, dst, dst.size(), 0, 0, interpolation); - -/* Point2f src_center(rgb.cols / 2.0F, rgb.rows / 2.0F); - Mat rot_mat = getRotationMatrix2D(src_center, -90, 1.0); - warpAffine(rgb, rgb, rot_mat, rgb.size());*/ - vector<Point> vertices = capture.GetArcusVertices(rgb); - for (size_t i = 0; i < vertices.size(); i++) { - circle(rgb, vertices[i], 2, CV_RGB(0, 0, 255), -1); - } + int w = sampleWidth; + int h = sampleHeight; - int w = correctedWidth; - int h = correctedHeight; + Mat sampleMat(h, w, CV_8UC4, (unsigned char *) pSampleOutPixels); - Mat wraped(h, w, CV_8UC4, (unsigned char *) pwrapedPixels); + if (vertices.size() == 4) + { + Mat detectedMat = capture.ApplyHomography(rgb, vertices, Size(w, h)); - if (vertices.size() == 4) { + bool passed_double_checking = true; - has_result = jboolean(true); + if (enableDoubleChecking) + { + vertices = capture.GetArcusVertices(detectedMat); + if (vertices.size() == 4) + { + passed_double_checking = true; + } + else + { + passed_double_checking = false; + } + } - Mat m = capture.ApplyHomography(rgb, vertices, Size(w, h)); + if (passed_double_checking) + { + has_result = jboolean(true); + } - //Draw Blocks! - BhBlocks b(m, w / 10, h / 11); - b.drawBlocks(m, Scalar(255, 0, 0), 1); - - cvtColor(m, wraped, COLOR_RGB2BGRA); - m.release(); + cvtColor(detectedMat, sampleMat, COLOR_RGB2BGRA); + detectedMat.release(); } cvtColor(rgb, result, COLOR_RGB2BGRA); -/* vector<Point> vertices = capture.GetQRVertices4(image); - - for (size_t i = 0; i < vertices.size(); i++) - { - circle(image, vertices[i], 2, CV_RGB(0, 0, 255), -1); - } - - int w = 330; - int h = 300; - int columns = 11; - int rows = 10; - - if (vertices.size() == 4) - { - capture.ApplyHomography(image, vertices, Size(w, h)); - BhBlocks b(image, w / columns, h / rows); - b.drawBlocks(image, Scalar(0, 0, 0), 1); - }*/ - - - jsize size = env->GetArrayLength(outPixels); - - env->ReleaseByteArrayElements(NV21FrameData, pNV21FrameData, 0); - env->ReleaseIntArrayElements(outPixels, poutPixels, 0); - env->ReleaseIntArrayElements(wrapedOutPixels, pwrapedPixels, 0); + env->ReleaseByteArrayElements(frameData, pFrameData, 0); + env->ReleaseIntArrayElements(frameOutPixels, pFrameOutPixels, 0); + env->ReleaseIntArrayElements(sampleOutPixels, pSampleOutPixels, 0); yuv.release(); rgb.release(); result.release(); - wraped.release(); + sampleMat.release(); dst.release(); gray.release(); } - catch (Exception ex) { + catch (Exception ex) + { env->ThrowNew(env->FindClass("java/lang/NullPointerException"), ex.what()); } return has_result; diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/App.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/App.java index d703526e2..335b4fe52 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/App.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/App.java @@ -7,6 +7,7 @@ import android.content.Context; import com.twine.colorcapture.dagger.ApplicationComponent; import com.twine.colorcapture.dagger.ApplicationModule; import com.twine.colorcapture.dagger.DaggerApplicationComponent; +import com.twine.colorcapture.web.WebApiFactory; import net.danlew.android.joda.JodaTimeAndroid; @@ -53,7 +54,7 @@ public class App extends Application //TangoDB.init(); //MessageFactory.init(); - //WebApiFactory.init("http://10.0.2.2:45455/api/"); + WebApiFactory.init(BuildConfig.WEB_SERVICE_ADDRESS); Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> { diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/ToggleImageButton.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/ToggleImageButton.java new file mode 100644 index 000000000..e23f3e7e7 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/controls/ToggleImageButton.java @@ -0,0 +1,148 @@ +package com.twine.colorcapture.controls; + +import android.content.Context; +import android.content.res.TypedArray; +import android.databinding.BindingAdapter; +import android.databinding.BindingMethod; +import android.databinding.BindingMethods; +import android.databinding.InverseBindingAdapter; +import android.databinding.InverseBindingListener; +import android.databinding.InverseBindingMethod; +import android.databinding.InverseBindingMethods; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.util.Log; +import android.widget.Checkable; +import android.widget.CompoundButton; + +import com.twine.colorcapture.R; + +@BindingMethods({ + @BindingMethod(type = ToggleImageButton.class, attribute = "checked", method = "setChecked"), +}) +@InverseBindingMethods({ + @InverseBindingMethod(type = ToggleImageButton.class, attribute = "checked", method = "getChecked"), +}) +public class ToggleImageButton extends android.support.v7.widget.AppCompatImageButton implements Checkable +{ + private OnCheckedChangeListener onCheckedChangeListener; + private Drawable normalImage; + private Drawable checkedImage; + + public ToggleImageButton(Context context) + { + super(context); + } + + public ToggleImageButton(Context context, AttributeSet attrs) + { + super(context, attrs); + setAttributes(attrs); + } + + public ToggleImageButton(Context context, AttributeSet attrs, int defStyle) + { + super(context, attrs, defStyle); + setAttributes(attrs); + } + + private void setAttributes(AttributeSet attrs) + { + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleImageButton); + + normalImage = getContext().getDrawable(a.getResourceId(R.styleable.ToggleImageButton_normalImage, 0)); + checkedImage = getContext().getDrawable(a.getResourceId(R.styleable.ToggleImageButton_checkedImage, 0)); + + setChecked(a.getBoolean(R.styleable.ToggleImageButton_android_checked, false)); + a.recycle(); + } + + @Override + public boolean isChecked() + { + return isSelected(); + } + + @Override + public void setChecked(boolean checked) + { + Log.d("DATA BINDING", "setChecked: "); + setSelected(checked); + + if (checked) + { + setImageDrawable(checkedImage); + } + else + { + setImageDrawable(normalImage); + } + + if (onCheckedChangeListener != null) + { + onCheckedChangeListener.onCheckedChanged(this, checked); + } + } + + public Boolean getChecked() + { + Log.d("DATA BINDING", "getChecked: "); + return isChecked(); + } + + @Override + public void toggle() + { + setChecked(!isChecked()); + } + + @Override + public boolean performClick() + { + if (!isChecked()) + { + setChecked(true); + } + else + { + return true; + } + + return super.performClick(); + } + + public OnCheckedChangeListener getOnCheckedChangeListener() + { + return onCheckedChangeListener; + } + + public void setOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener) + { + this.onCheckedChangeListener = onCheckedChangeListener; + } + + public static interface OnCheckedChangeListener + { + public void onCheckedChanged(ToggleImageButton buttonView, boolean isChecked); + } + + @BindingAdapter(value = "checkedAttrChanged") + public static void setListener(ToggleImageButton btn, final InverseBindingListener attrChange) + { + btn.setOnCheckedChangeListener((e, r) -> attrChange.onChange()); + } + + @BindingAdapter("checked") + public static void setChecked(ToggleImageButton view, Boolean value) + { + Log.d("DATA BINDING", "setChecked: "); + view.setChecked(value); + } + + @InverseBindingAdapter(attribute = "checked") + public static Boolean getChecked(ToggleImageButton view) + { + Log.d("DATA BINDING", "getChecked: "); + return view.isChecked(); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java index a5faab0d1..f19571b06 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java @@ -6,6 +6,8 @@ import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.view.animation.ScaleAnimation; +import java.io.IOException; + /** * Contains helper methods related to animations. */ @@ -34,7 +36,16 @@ public class AnimationsHelper @Override public void onAnimationEnd(Animation animation) { - if (onCompleted != null) onCompleted.invoke(); + if (onCompleted != null) + { + try + { + onCompleted.invoke(); + } catch (IOException e) + { + e.printStackTrace(); + } + } } @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/IAction.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/IAction.java index 5766f6cf3..35cf21cc4 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/IAction.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/IAction.java @@ -1,5 +1,7 @@ package com.twine.colorcapture.core; +import java.io.IOException; + /** * Represents an void Action delegate. */ @@ -8,5 +10,5 @@ public interface IAction /** * Invokes the action. */ - void invoke(); + void invoke() throws IOException; } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/Task.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/Task.java index 2858fbc3c..407de37d3 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/Task.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/Task.java @@ -2,33 +2,72 @@ package com.twine.colorcapture.core; import android.os.AsyncTask; -public class Task extends AsyncTask<String, Integer, String> { +import java.io.IOException; + +public class Task extends AsyncTask<String, Integer, String> +{ private IAction action; private IAction continueWithAction; + private IAction1<Exception> errorAction; + private boolean hasError; + private Exception error; + - public Task(IAction action) { + public Task(IAction action) + { this.action = action; } - public Task(IAction action, IAction continueWithAction) { + public Task(IAction action, IAction continueWithAction) + { this.action = action; this.continueWithAction = continueWithAction; } + public Task(IAction action, IAction continueWithAction, IAction1<Exception> errorAction) + { + this.action = action; + this.continueWithAction = continueWithAction; + this.errorAction = errorAction; + } + @Override - protected String doInBackground(String... strings) { - action.invoke(); + protected String doInBackground(String... strings) + { + try + { + action.invoke(); + } catch (Exception ex) + { + hasError = true; + error = ex; + } return null; } @Override - protected void onPostExecute(String s) { + protected void onPostExecute(String s) + { super.onPostExecute(s); - if (continueWithAction != null) + if (continueWithAction != null && !hasError) + { + try + { + continueWithAction.invoke(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + + if (hasError) { - continueWithAction.invoke(); + if (errorAction != null) + { + errorAction.invoke(error); + } } } @@ -42,6 +81,7 @@ public class Task extends AsyncTask<String, Integer, String> { private Task task; private IAction action; private IAction continueWithAction; + private IAction1<Exception> errorAction; public TaskBuilder setAction(IAction action) { @@ -55,9 +95,15 @@ public class Task extends AsyncTask<String, Integer, String> { return this; } + public TaskBuilder setError(IAction1<Exception> action) + { + this.errorAction = action; + return this; + } + public Task build() { - return new Task(action,continueWithAction); + return new Task(action, continueWithAction, errorAction); } } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java index b3a790039..f52f30a53 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java @@ -1,10 +1,10 @@ package com.twine.colorcapture.dagger; +import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; import com.twine.colorcapture.views.capture.CaptureFragment; -import com.twine.colorcapture.views.home.HomeFragment; -import com.twine.colorcapture.views.loading.LoadingFragment; +import com.twine.colorcapture.views.mycolors.MyColorsFragment; +import com.twine.colorcapture.views.loading.LoadingActivity; import com.twine.colorcapture.views.main.MainActivity; -import com.twine.colorcapture.views.main.MainActivityVM; import javax.inject.Singleton; @@ -15,17 +15,16 @@ import dagger.Component; */ @Singleton -@Component(modules = {ApplicationModule.class, ViewModelsModule.class, EventBusModule.class, NotificationModule.class, NavigationModule.class}) +@Component(modules = {ApplicationModule.class, ViewModelsModule.class, EventBusModule.class, NotificationModule.class, NavigationModule.class, WebModule.class}) public interface ApplicationComponent { - void inject(MainActivity view); - void inject(LoadingFragment view); + void inject(LoadingActivity view); - void inject(HomeFragment view); + void inject(MyColorsFragment view); void inject(CaptureFragment view); - MainActivityVM provideMainActivityVM(); + void inject(WelcomeDialog welcomeDialog); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/NavigationModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/NavigationModule.java index 476f248e0..7ccb6b06e 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/NavigationModule.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/NavigationModule.java @@ -14,8 +14,8 @@ public class NavigationModule { @Provides @Singleton - public INavigationProvider provideNavigation() + public INavigationProvider provideNavigation(Context context) { - return new AndroidNavigationProvider(); + return new AndroidNavigationProvider(context); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java index ff2e83a61..188089553 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java @@ -1,12 +1,15 @@ package com.twine.colorcapture.dagger; import com.squareup.otto.Bus; +import com.twine.colorcapture.dialogs.welcome.WelcomeDialogVM; import com.twine.colorcapture.navigation.INavigationProvider; import com.twine.colorcapture.notification.INotificationProvider; import com.twine.colorcapture.views.capture.CaptureFragmentVM; -import com.twine.colorcapture.views.home.HomeFragmentVM; -import com.twine.colorcapture.views.loading.LoadingFragmentVM; +import com.twine.colorcapture.views.loading.LoadingActivityVM; +import com.twine.colorcapture.views.mycolors.MyColorsFragmentVM; import com.twine.colorcapture.views.main.MainActivityVM; +import com.twine.colorcapture.web.ITCCService; +import com.twine.colorcapture.web.IWebServiceAPI; import javax.inject.Singleton; @@ -20,32 +23,39 @@ import dagger.Provides; @Module public class ViewModelsModule { - + @Provides @Singleton public MainActivityVM provideMainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) { return new MainActivityVM(eventBus, notificationProvider, navigationProvider); } - + @Provides @Singleton - public LoadingFragmentVM provideLoadingFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) + public LoadingActivityVM provideLoadingFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) { - return new LoadingFragmentVM(eventBus, notificationProvider, navigationProvider); + return new LoadingActivityVM(eventBus, notificationProvider, navigationProvider, tccService); } - + @Provides @Singleton - public HomeFragmentVM provideHomeFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) + public MyColorsFragmentVM provideMyColorsFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) { - return new HomeFragmentVM(navigationProvider); + return new MyColorsFragmentVM(navigationProvider); } - + + @Provides + @Singleton + public CaptureFragmentVM provideCaptureFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) + { + return new CaptureFragmentVM(tccService, navigationProvider); + } + @Provides @Singleton - public CaptureFragmentVM provideCaptureFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) + public WelcomeDialogVM provideWelcomeDialogVM(INotificationProvider notificationProvider) { - return new CaptureFragmentVM(); + return new WelcomeDialogVM(notificationProvider); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/WebModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/WebModule.java new file mode 100644 index 000000000..755f7b19c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/WebModule.java @@ -0,0 +1,29 @@ +package com.twine.colorcapture.dagger; + +import com.twine.colorcapture.web.ITCCService; +import com.twine.colorcapture.web.IWebServiceAPI; +import com.twine.colorcapture.web.TCCService; +import com.twine.colorcapture.web.WebApiFactory; + +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +@Module +public class WebModule +{ + @Provides + @Singleton + public IWebServiceAPI providerWebServiceAPI() + { + return WebApiFactory.getWebServiceApi(); + } + + @Provides + @Singleton + public ITCCService provideTCCService(IWebServiceAPI webServiceAPI) + { + return new TCCService(webServiceAPI); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/welcome/WelcomeDialog.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/welcome/WelcomeDialog.java new file mode 100644 index 000000000..5f92fff0e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/welcome/WelcomeDialog.java @@ -0,0 +1,22 @@ +package com.twine.colorcapture.dialogs.welcome; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.mvvm.DialogBase; +import com.twine.colorcapture.databinding.DialogWelcomeBinding; + +public class WelcomeDialog extends DialogBase<DialogWelcomeBinding, WelcomeDialogVM> +{ + + @Override + public int getLayoutId() + { + return R.layout.dialog_welcome; + } + + @Override + public void inject() + { + App.getComponent().inject(this); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/welcome/WelcomeDialogVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/welcome/WelcomeDialogVM.java new file mode 100644 index 000000000..f89ef2559 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dialogs/welcome/WelcomeDialogVM.java @@ -0,0 +1,24 @@ +package com.twine.colorcapture.dialogs.welcome; + +import com.twine.colorcapture.mvvm.DialogViewModelBase; +import com.twine.colorcapture.mvvm.RelayCommand; +import com.twine.colorcapture.notification.INotificationProvider; + +import javax.inject.Inject; + +public class WelcomeDialogVM extends DialogViewModelBase +{ + public RelayCommand startCommand; + + @Inject + public WelcomeDialogVM(INotificationProvider notificationProvider) + { + super(notificationProvider); + startCommand = new RelayCommand(this::close); + } + + public String getText() + { + return "Hi Roy"; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java index 386d9c525..7863cac80 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ActivityBase.java @@ -1,16 +1,19 @@ package com.twine.colorcapture.mvvm; +import android.app.Activity; import android.content.Intent; import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.view.View; +import android.view.Window; +import android.view.WindowManager; import android.widget.EditText; import android.widget.Toast; import com.mobsandgeeks.saripaar.ValidationError; import com.mobsandgeeks.saripaar.Validator; +import com.twine.colorcapture.R; import java.lang.reflect.Method; import java.util.List; @@ -26,7 +29,7 @@ import io.reactivex.functions.Consumer; * @param <BindingView> the type parameter * @param <VM> the type parameter */ -public abstract class ActivityBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends AppCompatActivity implements IView, Validator.ValidationListener { +public abstract class ActivityBase<BindingView extends ViewDataBinding, VM extends ViewModelBase> extends Activity implements IView, Validator.ValidationListener { /** * The constant ACTIVITY_CALLBACK_INTENT. @@ -48,7 +51,14 @@ public abstract class ActivityBase<BindingView extends ViewDataBinding, VM exten public BindingView binding; @Override - protected void onCreate(Bundle savedInstanceState) { + protected void onCreate(Bundle savedInstanceState) + { + Window window = getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryBackground)); + + overridePendingTransition(R.anim.zoom_in,R.anim.zoom_out); + super.onCreate(savedInstanceState); inject(); @@ -58,8 +68,6 @@ public abstract class ActivityBase<BindingView extends ViewDataBinding, VM exten Method method = binding.getClass().getDeclaredMethod("setVm", vm.getClass()); method.invoke(binding, vm); - attachView(); - ButterKnife.bind(this, binding.getRoot()); validator = new Validator(this); @@ -69,11 +77,16 @@ public abstract class ActivityBase<BindingView extends ViewDataBinding, VM exten if (key != null && !key.isEmpty()) { ActivityCallbackService.getInstance().runAndRemove(key); } + + onCreating(savedInstanceState); + attachView(); } catch (Exception e) { e.printStackTrace(); } } + + protected abstract void onCreating(Bundle savedInstanceState); @SuppressWarnings("unchecked") @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/BindingAdapters.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/BindingAdapters.java new file mode 100644 index 000000000..30cc259d6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/BindingAdapters.java @@ -0,0 +1,42 @@ +package com.twine.colorcapture.mvvm; + +import android.databinding.BindingAdapter; +import android.databinding.BindingConversion; +import android.databinding.BindingMethod; +import android.databinding.BindingMethods; +import android.databinding.InverseBindingAdapter; +import android.databinding.InverseBindingListener; +import android.databinding.InverseBindingMethod; +import android.databinding.InverseBindingMethods; +import android.util.Log; + +import com.twine.colorcapture.controls.ToggleImageButton; + +//@BindingMethods({ +// @BindingMethod(type = ToggleImageButton.class, attribute = "checked", method = "setChecked"), +//}) +//@InverseBindingMethods({ +// @InverseBindingMethod(type = ToggleImageButton.class, attribute = "checked", method = "getChecked"), +//}) +public class BindingAdapters +{ +// @BindingAdapter(value = "checkedAttrChanged") +// public static void setListener(ToggleImageButton btn, final InverseBindingListener attrChange) +// { +// btn.setOnCheckedChangeListener((e, r) -> attrChange.onChange()); +// } +// +// @BindingAdapter("checked") +// public static void setChecked(ToggleImageButton view, Boolean value) +// { +// Log.d("DATA BINDING", "setChecked: "); +// view.setChecked(value); +// } +// +// @InverseBindingAdapter(attribute = "checked") +// public static Boolean getChecked(ToggleImageButton view) +// { +// Log.d("DATA BINDING", "getChecked: "); +// return view.isChecked(); +// } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/BindingConverters.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/BindingConverters.java new file mode 100644 index 000000000..929d1ee0e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/BindingConverters.java @@ -0,0 +1,17 @@ +package com.twine.colorcapture.mvvm; + +import android.databinding.BindingConversion; +import android.databinding.InverseBindingMethod; + +public class BindingConverters +{ +// @BindingConversion +// public static boolean toInt(Boolean value) { +// return value; +// } +// +// @InverseBindingMethod() +// public static int toObject(int number) { +// return number; +// } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DependencyProperty.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DependencyProperty.java index 6856c071d..930e16dec 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DependencyProperty.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DependencyProperty.java @@ -5,6 +5,7 @@ import android.databinding.ObservableField; public class DependencyProperty <T> extends ObservableField<T> { private boolean blockNotify; + private boolean blockCallback; /** * The interface On property changed callback. @@ -76,6 +77,14 @@ public class DependencyProperty <T> extends ObservableField<T> { blockNotify = true; set(value); + blockNotify = false; + } + + public void setNoCallback(T value) + { + blockCallback = true; + set(value); + blockCallback = false; } @Override @@ -85,8 +94,6 @@ public class DependencyProperty <T> extends ObservableField<T> { super.notifyChange(); } - - blockNotify = false; } private void init() @@ -98,7 +105,7 @@ public class DependencyProperty <T> extends ObservableField<T> @Override public void onPropertyChanged(android.databinding.Observable observable, int i) { - if (that.callback != null) + if (that.callback != null && !that.blockCallback) { that.callback.onPropertyChanged(that, that.get()); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DialogBase.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DialogBase.java new file mode 100644 index 000000000..e17fb7724 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DialogBase.java @@ -0,0 +1,100 @@ +package com.twine.colorcapture.mvvm; + +import android.app.Dialog; +import android.app.DialogFragment; +import android.databinding.DataBindingUtil; +import android.databinding.ViewDataBinding; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.twine.colorcapture.R; + + +import java.lang.reflect.Method; + +import javax.inject.Inject; + +import butterknife.ButterKnife; + +public abstract class DialogBase<BindingView extends ViewDataBinding, VM extends DialogViewModelBase> extends DialogFragment +{ + /** + * The Vm. + */ + @Inject + VM vm; + + + /** + * The Binding. + */ + BindingView binding; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setStyle(DialogFragment.STYLE_NO_FRAME, R.style.AppTheme); + + + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) + { + + inject(); + + binding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()),getLayoutId(), null, false); + + Method method = null; + try + { + method = binding.getClass().getDeclaredMethod("setVm", vm.getClass()); + method.invoke(binding, vm); + + ButterKnife.bind(this, binding.getRoot()); + + return binding.getRoot(); + } + catch (Exception ex) + { + ex.printStackTrace(); + return null; + } + } + + @Override + public void onStart() + { + super.onStart(); + + getDialog().getWindow().setBackgroundDrawable(getActivity().getDrawable(R.color.colorBlueMask)); + + +// Dialog dialog = getDialog(); +// if (dialog != null) +// { +// int width = ViewGroup.LayoutParams.WRAP_CONTENT; +// int height = ViewGroup.LayoutParams.WRAP_CONTENT; +// dialog.getWindow().setLayout(width, height); +// dialog.getWindow().setA +// } + } + + public abstract int getLayoutId(); + + public abstract void inject(); + + public VM getVM() + { + return vm; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DialogViewModelBase.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DialogViewModelBase.java new file mode 100644 index 000000000..77c044178 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/DialogViewModelBase.java @@ -0,0 +1,18 @@ +package com.twine.colorcapture.mvvm; + +import com.twine.colorcapture.notification.INotificationProvider; + +public abstract class DialogViewModelBase extends ViewModelBase +{ + protected INotificationProvider notificationProvider; + + public DialogViewModelBase(INotificationProvider notificationProvider) + { + this.notificationProvider = notificationProvider; + } + + public void close() + { + notificationProvider.closeDialog(); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ExtendedObject.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ExtendedObject.java index 8ee60bec7..184c4fb6d 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ExtendedObject.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/ExtendedObject.java @@ -1,6 +1,8 @@ package com.twine.colorcapture.mvvm; -public class ExtendedObject +import android.databinding.BaseObservable; + +public class ExtendedObject extends BaseObservable { } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java index 175a99b77..70dd04372 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java @@ -1,7 +1,10 @@ package com.twine.colorcapture.navigation; +import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; +import android.content.Context; +import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.util.Log; @@ -10,38 +13,52 @@ import com.twine.colorcapture.mvvm.ExtendedObject; import com.twine.colorcapture.mvvm.FragmentBase; import com.twine.colorcapture.core.IAction1; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.inject.Inject; + /** * Represents an android navigation provider. */ public class AndroidNavigationProvider extends ExtendedObject implements INavigationProvider { - private AppCompatActivity activity; + private Activity activity; private FragmentBase currentFragment; + private String currentFragmentName; private int fragment_container; - private String basePackagePath; + private String basePackagePath = "com.twine.colorcapture.views"; private boolean isFirst = true; - + private Context context; + private List<FragmentNavigatedListener> fragmentNavigatedListeners; + + @Inject + public AndroidNavigationProvider(Context context) + { + this.context = context; + fragmentNavigatedListeners = new ArrayList<>(); + } + @Override - public void registerNavigationActivity(AppCompatActivity activity, int fragmentContainerId, String basePackagePath) + public void registerNavigationActivity(Activity activity, int fragmentContainerId) { this.activity = activity; this.fragment_container = fragmentContainerId; - this.basePackagePath = basePackagePath; } - @Override - public void navigateTo(Enum fragmentValue, boolean addToHistory) + public void navigateTo(NavigationFragment fragmentValue, boolean addToHistory) { navigateTo(fragmentValue.name(),addToHistory); } @Override - public void navigateTo(Enum fragmentValue, IAction1<FragmentBase> onCreateListener, boolean addToHistory) + public void navigateTo(NavigationFragment fragmentValue, IAction1<FragmentBase> onCreateListener, boolean addToHistory) { navigateTo(fragmentValue.name(), onCreateListener,addToHistory); } - + @Override public void navigateTo(String fragmentName, boolean addToHistory) { @@ -56,7 +73,23 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga //logManager.log(new NullPointerException("No navigation activity registered.")); return; } - + + boolean reverseAnimation = false; + + + if (currentFragmentName != null) + { + List<NavigationFragment> values = Arrays.asList(NavigationFragment.values()); + + int newIndex = values.indexOf(NavigationFragment.valueOf(fragmentName)); + int oldIndex = values.indexOf(NavigationFragment.valueOf(currentFragmentName)); + + if (oldIndex > newIndex) { + reverseAnimation = true; + } + } + + String originalName = fragmentName; fragmentName = basePackagePath + "." + fragmentName.toLowerCase() + "." + fragmentName + "Fragment"; FragmentManager fragmentManager = activity.getFragmentManager(); @@ -107,7 +140,14 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga if (!isFirst) { - fragmentTransaction.setCustomAnimations(R.animator.slide_in_left, R.animator.slide_out_left, R.animator.slide_out_right, R.animator.slide_in_right); + if (!reverseAnimation) + { + fragmentTransaction.setCustomAnimations(R.animator.slide_out_right, R.animator.slide_in_right , R.animator.slide_in_left, R.animator.slide_out_left); + } + else + { + fragmentTransaction.setCustomAnimations(R.animator.slide_in_left, R.animator.slide_out_left, R.animator.slide_out_right, R.animator.slide_in_right); + } } isFirst = false; @@ -131,5 +171,39 @@ public class AndroidNavigationProvider extends ExtendedObject implements INaviga // } currentFragment = fragment; + currentFragmentName = originalName; + + NavigationFragment f = NavigationFragment.valueOf(originalName); + for (FragmentNavigatedListener listener : fragmentNavigatedListeners) + { + listener.onNavigated(f); + } + + } + + @Override + public void navigateTo(NavigationActivity activityValue, boolean addToHistory) + { + String name = activityValue.name(); + String activityName = basePackagePath + "." + name.toLowerCase() + "." + name + "Activity"; + try { + Class cls = Class.forName(activityName); + Intent intent = new Intent(context, cls); + + if (!addToHistory) { + intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY); + } + + context.startActivity(intent); + + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + + @Override + public void addFragmentNavigationListener(FragmentNavigatedListener listener) + { + fragmentNavigatedListeners.add(listener); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java index a6567d576..dc4bb83d4 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/INavigationProvider.java @@ -1,6 +1,6 @@ package com.twine.colorcapture.navigation; -import android.support.v7.app.AppCompatActivity; +import android.app.Activity; import com.twine.colorcapture.mvvm.FragmentBase; import com.twine.colorcapture.core.IAction1; @@ -10,14 +10,18 @@ import com.twine.colorcapture.core.IAction1; */ public interface INavigationProvider { + interface FragmentNavigatedListener + { + void onNavigated(NavigationFragment fragment); + } + /** * Register navigation activity. * * @param activity the activity * @param fragmentContainerId the fragment container id - * @param basePackagePath the base package path */ - void registerNavigationActivity(AppCompatActivity activity, int fragmentContainerId, String basePackagePath); + void registerNavigationActivity(Activity activity, int fragmentContainerId); /** * Navigate to the specified fragment name. @@ -39,7 +43,7 @@ public interface INavigationProvider * * @param fragmentValue the fragment value */ - void navigateTo(Enum fragmentValue, boolean addToHistory); + void navigateTo(NavigationFragment fragmentValue, boolean addToHistory); /** * Navigate to to the specified enum value fragment name. @@ -47,5 +51,9 @@ public interface INavigationProvider * @param fragmentValue the fragment value * @param onCreateListener the on create listener */ - void navigateTo(Enum fragmentValue, IAction1<FragmentBase> onCreateListener, boolean addToHistory); + void navigateTo(NavigationFragment fragmentValue, IAction1<FragmentBase> onCreateListener, boolean addToHistory); + + void navigateTo(NavigationActivity activityValue, boolean addToHistory); + + void addFragmentNavigationListener(FragmentNavigatedListener listener); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationView.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationActivity.java index d336d1930..b03f688bc 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationView.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationActivity.java @@ -1,8 +1,7 @@ package com.twine.colorcapture.navigation; -public enum NavigationView +public enum NavigationActivity { Loading, - Home, - Capture, + Main, } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java new file mode 100644 index 000000000..65a6d38e7 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/NavigationFragment.java @@ -0,0 +1,7 @@ +package com.twine.colorcapture.navigation; + +public enum NavigationFragment +{ + MyColors, + Capture, +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java index d07502af4..f3081754c 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/AndroidNotificationProvider.java @@ -1,10 +1,15 @@ package com.twine.colorcapture.notification; +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentTransaction; import android.content.Context; import android.support.v7.app.AlertDialog; import android.widget.Toast; import com.twine.colorcapture.core.IAction; +import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; +import com.twine.colorcapture.mvvm.DialogBase; import com.twine.colorcapture.mvvm.IView; @@ -15,6 +20,8 @@ public class AndroidNotificationProvider implements INotificationProvider { private Context context; + private Activity activity; + private DialogBase lastDialog; /** * Instantiates a new Android notification provider. @@ -25,33 +32,41 @@ public class AndroidNotificationProvider implements INotificationProvider { this.context = context; } - + + @Override + public void registerMainActivity(Activity activity) + { + this.activity = activity; + } + @Override public void toast(String message) { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } - + @Override - public void showMessage(IView view, String message) + public void showDialog(DialogBase dialog) { - showMessage(view, message, null); + lastDialog = dialog; + FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); + Fragment prev = activity.getFragmentManager().findFragmentByTag("dialog"); + if (prev != null) { + ft.remove(prev); + } + ft.addToBackStack(null); + + //show the dialog. + dialog.show(ft, "dialog"); } - + @Override - public void showMessage(IView view, String message, IAction action) + public void closeDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder((Context) view); - builder.setMessage("Look at this dialog!") - .setCancelable(false) - .setTitle("Tango") - .setMessage(message) - .setIcon(android.R.drawable.ic_dialog_info) - .setPositiveButton("OK", (dialog, id) -> - { - if (action != null) action.invoke(); - }); - AlertDialog alert = builder.create(); - alert.show(); + if (lastDialog != null) + { + lastDialog.dismiss(); + lastDialog = null; + } } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java index 8103fff38..7f972f3a3 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/notification/INotificationProvider.java @@ -1,6 +1,9 @@ package com.twine.colorcapture.notification; +import android.app.Activity; + import com.twine.colorcapture.core.IAction; +import com.twine.colorcapture.mvvm.DialogBase; import com.twine.colorcapture.mvvm.IView; @@ -9,29 +12,24 @@ import com.twine.colorcapture.mvvm.IView; */ public interface INotificationProvider { - + + void registerMainActivity(Activity activity); + /** * Toast. * * @param message the message */ void toast(String message); - + /** - * Show message. - * - * @param view the view - * @param message the message + * Display the specified dialog. + * @param dialog */ - void showMessage(IView view, String message); - + void showDialog(DialogBase dialog); + /** - * Show message. - * - * @param view the view - * @param message the message - * @param action the action + * Closes the last dialog. */ - void showMessage(IView view, String message, IAction action); - + void closeDialog(); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java index 373f1009a..49f61c7a3 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java @@ -2,5 +2,14 @@ package com.twine.colorcapture.opencv; public class ImageProcessor { - public native boolean ProcessImage(int width, int height,int correctedWidth,int correctedHeight, byte[] NV21FrameData, int[] pixels,int[] wpixels); + public native boolean ProcessImage(int frameWidth, + int frameHeight, + int sampleWidth, + int sampleHeight, + int histogramMethod, + double similarityTolerance, + boolean enableDoubleChecking, + byte[] frameData, + int[] frameOutPixels, + int[] sampleOutPixels); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/utils/BitmapUtils.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/utils/BitmapUtils.java new file mode 100644 index 000000000..7f53974b8 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/utils/BitmapUtils.java @@ -0,0 +1,25 @@ +package com.twine.colorcapture.utils; + +import android.graphics.Bitmap; +import android.util.Base64; + +import java.io.ByteArrayOutputStream; +import java.nio.ByteBuffer; + +public class BitmapUtils +{ + public static byte[] getBitmapBytes(Bitmap bitmap) + { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] byteArray = stream.toByteArray(); + return byteArray; + } + + public static String getBitmapBase64String(Bitmap bitmap) + { + byte[] data = getBitmapBytes(bitmap); + String encoded = Base64.encodeToString(data, Base64.DEFAULT); + return encoded; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java index 87e5c56cd..f09e6448f 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java @@ -1,7 +1,9 @@ package com.twine.colorcapture.views.capture; +import android.Manifest; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; +import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.ImageFormat; import android.hardware.Camera; @@ -10,6 +12,9 @@ import android.hardware.Camera.Size; import android.os.Build; import android.os.Handler; import android.os.Looper; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; @@ -23,6 +28,7 @@ import android.widget.ImageView; import com.twine.colorcapture.App; import com.twine.colorcapture.R; +import com.twine.colorcapture.core.IAction1; import com.twine.colorcapture.core.Task.TaskBuilder; import com.twine.colorcapture.databinding.FragmentCaptureBinding; import com.twine.colorcapture.mvvm.FragmentBase; @@ -46,6 +52,7 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur private Handler mHandler; private SurfaceView surfaceView; private ICaptureFragmentListener listener; + private IAction1<Boolean> cameraAccessAction; ObjectAnimator animator; View scannerLayout; View scannerBar; @@ -60,24 +67,30 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur protected void onCreated() { super.onCreated(); - - imagePreview = getView().findViewById(R.id.imagePreview); - imagewrappedPreview = getView().findViewById(R.id.imagePreviewWrapped); - - surfaceView = new SurfaceView(this.getActivity()); - - SurfaceHolder camHolder = surfaceView.getHolder(); - camHolder.addCallback(this); - camHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - - FrameLayout surfraceFrame = (FrameLayout) getView().findViewById(R.id.surfaceViewFrame); - - startScanAnimation(); - - new Handler().postDelayed(() -> + + requestCameraAccess((granted) -> { - surfraceFrame.addView(surfaceView, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); - }, 500); + if (granted) + { + imagePreview = getView().findViewById(R.id.imagePreview); + imagewrappedPreview = getView().findViewById(R.id.imagePreviewWrapped); + + surfaceView = new SurfaceView(this.getActivity()); + + SurfaceHolder camHolder = surfaceView.getHolder(); + camHolder.addCallback(this); + camHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + + FrameLayout surfraceFrame = (FrameLayout) getView().findViewById(R.id.surfaceViewFrame); + + startScanAnimation(); + + new Handler().postDelayed(() -> + { + surfraceFrame.addView(surfaceView, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); + }, 500); + } + }); } private void startScanAnimation() @@ -275,4 +288,45 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur imagePreview.setImageBitmap(frameBitmap); imagewrappedPreview.setImageBitmap(correctedBitmap); } + + public void requestCameraAccess(IAction1<Boolean> action) + { + cameraAccessAction = action; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) + { + if (ContextCompat.checkSelfPermission(this.getActivity(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) + { + ActivityCompat.requestPermissions(this.getActivity(), + new String[]{Manifest.permission.CAMERA}, + 1); + } + else + { + cameraAccessAction.invoke(true); + } + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) + { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + + switch (requestCode) + { + case 1: + { + if (grantResults.length > 0 + && grantResults[0] == PackageManager.PERMISSION_GRANTED) + { + cameraAccessAction.invoke(true); + } + else + { + cameraAccessAction.invoke(false); + } + } + } + } }
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java index b434b9dfb..3f173c530 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java @@ -2,43 +2,61 @@ package com.twine.colorcapture.views.capture; import android.graphics.Bitmap; import android.util.Log; -import android.util.Size; import com.twine.colorcapture.core.Task.TaskBuilder; import com.twine.colorcapture.mvvm.ViewModelBase; +import com.twine.colorcapture.navigation.INavigationProvider; import com.twine.colorcapture.opencv.ImageProcessor; import com.twine.colorcapture.views.capture.ICaptureFragment.ICaptureFragmentListener; +import com.twine.colorcapture.web.ITCCService; +import com.twine.colorcapture.web.messages.DefinitionResponse; +import com.twine.colorcapture.web.messages.DetectionResponse; import com.yanzhenjie.zbar.Image; import com.yanzhenjie.zbar.ImageScanner; import com.yanzhenjie.zbar.Symbol; import com.yanzhenjie.zbar.SymbolSet; +import java.io.IOException; + public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implements ICaptureFragmentListener { + private ImageProcessor processor; private Bitmap frameBitmap = null; - private Bitmap correctedBitmap = null; + private Bitmap sampleBitmap = null; private int[] framePixels = null; - private int[] correctedPixels = null; + private int[] samplePixels = null; private int previewWidth; private int previewHeight; private boolean isProcessing; private byte[] frameData; private String barcode; - private Size correctedSize = new Size(300, 330); //The desired cropped rectified bitmap. - - public CaptureFragmentVM() + private ITCCService tccService; + private DefinitionResponse definition; + private INavigationProvider navigationProvider; + + public CaptureFragmentVM(ITCCService tccService, INavigationProvider navigationProvider) { + this.navigationProvider = navigationProvider; + this.tccService = tccService; processor = new ImageProcessor(); + + try + { + definition = tccService.getDefinition(); + } catch (IOException e) + { + e.printStackTrace(); + } } - + @Override protected void onViewAttached(ICaptureFragment view) { super.onViewAttached(view); view.setListener(this); } - + @SuppressWarnings("SuspiciousNameCombination") @Override public void onFrameAvailable(byte[] frame) @@ -46,60 +64,74 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement if (!isProcessing) { isProcessing = true; - + frameData = frame; - + new TaskBuilder() .setAction(() -> { isProcessing = true; - - processor.ProcessImage( + + boolean detected = processor.ProcessImage( previewWidth, previewHeight, - correctedSize.getWidth(), - correctedSize.getHeight(), + definition.getSampleWidth(), + definition.getSampleHeight(), + definition.getHistogramMethod(), + definition.getSimilarityTolerance(), + definition.isEnableDoubleChecking(), frameData, framePixels, - correctedPixels); - + samplePixels); + frameBitmap.setPixels(framePixels, 0, previewHeight, 0, 0, previewHeight, previewWidth); - correctedBitmap.setPixels(correctedPixels, 0, correctedSize.getWidth(), 0, 0, correctedSize.getWidth(), correctedSize.getHeight()); - - - Log.d("BARCODE", "scanning barcode..."); - ImageScanner scanner = new ImageScanner(); - Image img = new Image(frameBitmap.getWidth(), frameBitmap.getHeight(), "RGB4"); - img.setData(framePixels); - int result = scanner.scanImage(img.convert("Y800")); - - if (result != 0) + + if (detected) { - Log.d("BARCODE", "Got positive result..."); - - String text = null; - - SymbolSet symSet = scanner.getResults(); - for (Symbol sym : symSet) - text = sym.getData(); - - - barcode = text; - - Log.d("BARCODE", "Barcode text is: " + text); + sampleBitmap.setPixels(samplePixels, 0, definition.getSampleWidth(), 0, 0, definition.getSampleWidth(), definition.getSampleHeight()); + + Log.d("BARCODE", "scanning barcode..."); + ImageScanner scanner = new ImageScanner(); + Image img = new Image(frameBitmap.getWidth(), frameBitmap.getHeight(), "RGB4"); + img.setData(framePixels); + int result = scanner.scanImage(img.convert("Y800")); + + if (result != 0) + { + Log.d("BARCODE", "Got positive result..."); + + String text = null; + + SymbolSet symSet = scanner.getResults(); + for (Symbol sym : symSet) + text = sym.getData(); + + + barcode = text; + + Log.d("BARCODE", "Barcode text is: " + text); + + DetectionResponse response = tccService.detect(sampleBitmap,barcode); + DetectionResponse a = response; + } } - + }) .setContinueWith(() -> { - view.onFrameResult(frameBitmap, correctedBitmap, barcode); + view.onFrameResult(frameBitmap, sampleBitmap, barcode); + isProcessing = false; + }) + .setError((ex) -> + { isProcessing = false; + ex.printStackTrace(); }) .build() .start(); } } - + @SuppressWarnings("SuspiciousNameCombination") @Override public void onPreviewSettingsAvailable(int previewWidth, int previewHeight) @@ -107,8 +139,8 @@ public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implement this.previewWidth = previewWidth; this.previewHeight = previewHeight; frameBitmap = Bitmap.createBitmap(previewHeight, previewWidth, Bitmap.Config.ARGB_8888); - correctedBitmap = Bitmap.createBitmap(correctedSize.getWidth(), correctedSize.getHeight(), Bitmap.Config.ARGB_8888); + sampleBitmap = Bitmap.createBitmap(definition.getSampleWidth(), definition.getSampleHeight(), Bitmap.Config.ARGB_8888); framePixels = new int[previewWidth * previewHeight]; - correctedPixels = new int[correctedSize.getWidth() * correctedSize.getHeight()]; + samplePixels = new int[definition.getSampleWidth() * definition.getSampleHeight()]; } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/HomeFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/HomeFragment.java deleted file mode 100644 index 76bdfe20f..000000000 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/HomeFragment.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.twine.colorcapture.views.home; -import android.Manifest; -import android.content.pm.PackageManager; -import android.os.Build; -import android.support.annotation.NonNull; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; - -import com.twine.colorcapture.App; -import com.twine.colorcapture.R; -import com.twine.colorcapture.core.IAction1; -import com.twine.colorcapture.databinding.FragmentHomeBinding; -import com.twine.colorcapture.mvvm.FragmentBase; - -public class HomeFragment extends FragmentBase<FragmentHomeBinding, HomeFragmentVM> implements IHomeFragment -{ - private IAction1<Boolean> cameraAccessAction; - - public HomeFragment() - { - // Required empty public constructor - } - - @Override - protected int getLayoutId() - { - return R.layout.fragment_home; - } - - @Override - protected void inject() - { - App.getComponent().inject(this); - } - - @Override - public String getTitle() - { - return "Home"; - } - - @Override - public void requestCameraAccess(IAction1<Boolean> action) - { - cameraAccessAction = action; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - if (ContextCompat.checkSelfPermission(this.getActivity(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(this.getActivity(), - new String[]{Manifest.permission.CAMERA}, - 1); - } - else - { - cameraAccessAction.invoke(true); - } - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - - switch (requestCode) { - case 1: { - if (grantResults.length > 0 - && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - cameraAccessAction.invoke(true); - } else { - cameraAccessAction.invoke(false); - } - } - } - } -} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/HomeFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/HomeFragmentVM.java deleted file mode 100644 index d7b8e3ba7..000000000 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/HomeFragmentVM.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.twine.colorcapture.views.home; - -import com.twine.colorcapture.mvvm.RelayCommand; -import com.twine.colorcapture.mvvm.ViewModelBase; -import com.twine.colorcapture.navigation.INavigationProvider; -import com.twine.colorcapture.navigation.NavigationView; - -import javax.inject.Inject; - -public class HomeFragmentVM extends ViewModelBase<IHomeFragment> -{ - private INavigationProvider navigationProvider; - public RelayCommand startCaptureCommand; - - @Inject - public HomeFragmentVM(INavigationProvider navigationProvider) - { - this.navigationProvider = navigationProvider; - - startCaptureCommand = new RelayCommand(() -> - { - view.requestCameraAccess((granted) -> - { - if (granted) - { - this.navigationProvider.navigateTo(NavigationView.Capture, true); - } - }); - }); - } -} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/IHomeFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/IHomeFragment.java deleted file mode 100644 index 17f94c7db..000000000 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/home/IHomeFragment.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.twine.colorcapture.views.home; - -import com.twine.colorcapture.core.IAction; -import com.twine.colorcapture.core.IAction1; -import com.twine.colorcapture.mvvm.IView; - -public interface IHomeFragment extends IView -{ - void requestCameraAccess(IAction1<Boolean> action); -} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/ILoadingFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/ILoadingActivity.java index b887f59e2..a9d7d44ce 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/ILoadingFragment.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/ILoadingActivity.java @@ -2,6 +2,6 @@ package com.twine.colorcapture.views.loading; import com.twine.colorcapture.mvvm.IView; -public interface ILoadingFragment extends IView +public interface ILoadingActivity extends IView { } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingActivity.java new file mode 100644 index 000000000..ae38d2368 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingActivity.java @@ -0,0 +1,46 @@ +package com.twine.colorcapture.views.loading; + + +import android.app.Fragment; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.view.Window; +import android.view.WindowManager; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.databinding.ActivityLoadingBinding; +import com.twine.colorcapture.mvvm.ActivityBase; +import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.navigation.NavigationActivity; +import com.twine.colorcapture.views.main.MainActivity; + +import javax.inject.Inject; + +import io.reactivex.functions.Consumer; + +/** + * A simple {@link Fragment} subclass. + */ +public class LoadingActivity extends ActivityBase<ActivityLoadingBinding, LoadingActivityVM> implements ILoadingActivity +{ + @Inject + public INavigationProvider navigationProvider; + + @Override + protected void onCreating(Bundle savedInstanceState) + { + + } + + @Override + protected int getLayoutId() { + return R.layout.activity_loading; + } + + @Override + protected void inject() { + App.getComponent().inject(this); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingActivityVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingActivityVM.java new file mode 100644 index 000000000..8cf9c1ef6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingActivityVM.java @@ -0,0 +1,76 @@ +package com.twine.colorcapture.views.loading; + +import android.annotation.SuppressLint; +import android.os.CountDownTimer; +import android.os.Handler; +import android.util.Log; + +import com.squareup.otto.Bus; +import com.twine.colorcapture.BuildConfig; +import com.twine.colorcapture.core.Task; +import com.twine.colorcapture.mvvm.DependencyProperty; +import com.twine.colorcapture.mvvm.ViewModelBase; +import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.navigation.NavigationActivity; +import com.twine.colorcapture.navigation.NavigationFragment; +import com.twine.colorcapture.notification.INotificationProvider; +import com.twine.colorcapture.web.ITCCService; +import com.twine.colorcapture.web.IWebServiceAPI; +import com.twine.colorcapture.web.WebApiFactory; +import com.twine.colorcapture.web.messages.DefinitionRequest; +import com.twine.colorcapture.web.messages.DefinitionResponse; +import com.twine.colorcapture.web.messages.LoginRequest; +import com.twine.colorcapture.web.messages.LoginResponse; + +import java.io.IOException; + +import javax.inject.Inject; + +import io.reactivex.disposables.Disposable; + +public class LoadingActivityVM extends ViewModelBase<ILoadingActivity> +{ + private INavigationProvider navigationProvider; + private ITCCService tccService; + private boolean initialized; + public DependencyProperty<Integer> loadingProgress; + + + @Inject + public LoadingActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITCCService tccService) + { + this.tccService = tccService; + this.navigationProvider = navigationProvider; + loadingProgress = new DependencyProperty<>(0); + } + + @Override + protected void onViewAttached(ILoadingActivity view) + { + super.onViewAttached(view); + init(); + } + + private void init() + { + if (!initialized) + { + new Task.TaskBuilder().setAction(() -> + { + tccService.getDefinition(); + }).setContinueWith(() -> + { + initialized = true; + navigationProvider.navigateTo(NavigationActivity.Main, true); + + }).setError((ex) -> + { + new Handler().postDelayed(this::init,5000); + }).build().start(); + } + else + { + navigationProvider.navigateTo(NavigationActivity.Main, true); + } + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingFragment.java deleted file mode 100644 index 4a549b59b..000000000 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingFragment.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.twine.colorcapture.views.loading; - - -import android.app.Fragment; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.twine.colorcapture.App; -import com.twine.colorcapture.R; -import com.twine.colorcapture.databinding.FragmentLoadingBinding; -import com.twine.colorcapture.mvvm.FragmentBase; - -import io.reactivex.functions.Consumer; - -/** - * A simple {@link Fragment} subclass. - */ -public class LoadingFragment extends FragmentBase<FragmentLoadingBinding, LoadingFragmentVM> implements ILoadingFragment -{ - - public LoadingFragment() - { - // Required empty public constructor - } - - @Override - protected int getLayoutId() - { - return R.layout.fragment_loading; - } - - @Override - protected void inject() - { - App.getComponent().inject(this); - } - - @Override - public String getTitle() - { - return "Loading"; - } -} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingFragmentVM.java deleted file mode 100644 index ecce7a74e..000000000 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/loading/LoadingFragmentVM.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.twine.colorcapture.views.loading; - -import android.os.CountDownTimer; -import android.os.Handler; - -import com.squareup.otto.Bus; -import com.twine.colorcapture.mvvm.DependencyProperty; -import com.twine.colorcapture.mvvm.ViewModelBase; -import com.twine.colorcapture.navigation.INavigationProvider; -import com.twine.colorcapture.navigation.NavigationView; -import com.twine.colorcapture.notification.INotificationProvider; - -import javax.inject.Inject; - -public class LoadingFragmentVM extends ViewModelBase<ILoadingFragment> -{ - private INavigationProvider navigationProvider; - public DependencyProperty<Integer> loadingProgress; - - @Inject - public LoadingFragmentVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) - { - - this.navigationProvider = navigationProvider; - - loadingProgress = new DependencyProperty<>(0); - } - - @Override - protected void onViewAttached(ILoadingFragment view) - { - super.onViewAttached(view); - - new CountDownTimer(2000,50) - { - - @Override - public void onTick(long l) { - - loadingProgress.set(loadingProgress.get() + 50); - } - - @Override - public void onFinish() { - - loadingProgress.set(2000); - navigationProvider.navigateTo(NavigationView.Home, false); - } - }.start(); - } -} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java index 74e3d5707..f50d4a5c4 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java @@ -1,136 +1,86 @@ package com.twine.colorcapture.views.main; +import android.app.Fragment; import android.app.FragmentTransaction; -import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.os.Handler; import android.support.v4.widget.DrawerLayout; import android.util.Log; import android.view.Gravity; import android.view.View; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.view.animation.Animation.AnimationListener; -import android.view.animation.ScaleAnimation; -import android.widget.Button; -import android.widget.FrameLayout; +import android.view.ViewGroup; import android.widget.LinearLayout; import com.twine.colorcapture.App; import com.twine.colorcapture.R; -import com.twine.colorcapture.core.IAction; -import com.twine.colorcapture.core.Task; +import com.twine.colorcapture.controls.ToggleImageButton; import com.twine.colorcapture.databinding.ActivityMainBinding; +import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; import com.twine.colorcapture.mvvm.ActivityBase; import com.twine.colorcapture.navigation.INavigationProvider; -import com.twine.colorcapture.navigation.NavigationView; -import com.twine.onboarding.PaperOnboardingFragment; -import com.twine.onboarding.PaperOnboardingPage; - -import java.util.ArrayList; +import com.twine.colorcapture.navigation.NavigationFragment; +import com.twine.colorcapture.notification.INotificationProvider; import javax.inject.Inject; import butterknife.BindView; -import butterknife.ButterKnife; public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivityVM> implements IMainActivity { - private boolean displayOnboarding = false; - + @Inject public INavigationProvider navigationProvider; - + + @Inject + public INotificationProvider notificationProvider; + @BindView(R.id.btnMenu) - Button btnMenu; - + ToggleImageButton btnMenu; + @BindView(R.id.header) LinearLayout frameHeader; - + @BindView(R.id.drawerLayout) DrawerLayout drawerLayout; - + // Used to load the 'native-lib' library on application startup. - static - { + static { System.loadLibrary("opencv_java3"); System.loadLibrary("native-lib"); } - + @Override - protected void onCreate(Bundle savedInstanceState) + protected void onCreating(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - ButterKnife.bind(this); - - navigationProvider.registerNavigationActivity(this, R.id.fragment_container, "com.twine.colorcapture.views"); - - if (displayOnboarding) - { - PaperOnboardingPage scr1 = new PaperOnboardingPage("Welcome to true color capture", - "All hotels and hostels are sorted by hospitality rating", - Color.parseColor("#678FB4"), R.drawable.hand_fabric, R.drawable.onboarding_pager_round_icon); - PaperOnboardingPage scr2 = new PaperOnboardingPage("Banks", - "We carefully verify all banks before add them into the app", - Color.parseColor("#65B0B4"), R.drawable.hand_phone, R.drawable.onboarding_pager_round_icon); - PaperOnboardingPage scr3 = new PaperOnboardingPage("Stores", - "All local stores are categorized for your convenience", - Color.parseColor("#9B90BC"), R.drawable.take_picture, R.drawable.onboarding_pager_round_icon); - - ArrayList<PaperOnboardingPage> elements = new ArrayList<>(); - elements.add(scr1); - elements.add(scr2); - elements.add(scr3); - - PaperOnboardingFragment onboardingFragment = PaperOnboardingFragment.newInstance(elements); - - onboardingFragment.setOnRightOutListener(() -> - { - showHeader(); - navigationProvider.navigateTo(NavigationView.Loading, false); - - }); - - FragmentTransaction fragmentTransaction = this.getFragmentManager().beginTransaction(); - fragmentTransaction.add(R.id.fragment_container, onboardingFragment); - fragmentTransaction.commit(); - } - else - { - new Handler().postDelayed(this::showHeader,2000); - navigationProvider.navigateTo(NavigationView.Loading, false); - } - + navigationProvider.registerNavigationActivity(this, R.id.fragment_container); + notificationProvider.registerMainActivity(this); + Log.d("TCC", "Registering event listener..."); - + btnMenu.setOnClickListener((x) -> { Log.d("TCC", "Clicked..."); drawerLayout.openDrawer(Gravity.START); }); + + navigationProvider.navigateTo(NavigationFragment.Capture, false); } - + @Override - protected int getLayoutId() - { + protected int getLayoutId() { return R.layout.activity_main; } - + @Override - protected void inject() - { + protected void inject() { App.getComponent().inject(this); } - - private void showHeader() - { + + private void showHeader() { frameHeader.setVisibility(View.VISIBLE); } - - private void hideHeader() - { + + private void hideHeader() { frameHeader.setVisibility(View.GONE); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java index dc08f701c..b5ddc1c2d 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java @@ -1,22 +1,108 @@ package com.twine.colorcapture.views.main; import com.squareup.otto.Bus; +import com.twine.colorcapture.dialogs.welcome.WelcomeDialog; import com.twine.colorcapture.mvvm.DependencyProperty; -import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationProvider; -import com.twine.colorcapture.navigation.NavigationView; +import com.twine.colorcapture.navigation.NavigationFragment; import com.twine.colorcapture.notification.INotificationProvider; import javax.inject.Inject; public class MainActivityVM extends ViewModelBase<IMainActivity> { + public enum CurrentTab + { + More, + Capture, + MyColors + } + private INavigationProvider navigationProvider; - + private INotificationProvider notificationProvider; + private CurrentTab currentTab; + + public DependencyProperty<Boolean> isMoreToggled; + public DependencyProperty<Boolean> isCaptureToggled; + public DependencyProperty<Boolean> isMyColorsToggled; + @Inject public MainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider) { this.navigationProvider = navigationProvider; + this.notificationProvider = notificationProvider; + isMoreToggled = new DependencyProperty<Boolean>(false,this::onMoreToggled); + isCaptureToggled = new DependencyProperty<Boolean>(false,this::onCaptureToggled); + isMyColorsToggled = new DependencyProperty<Boolean>(false,this::onMyColorsToggled); + currentTab = CurrentTab.Capture; + setCurrentTab(currentTab); + navigationProvider.addFragmentNavigationListener(this::onNavigation); + } + + private void onNavigation(NavigationFragment navigationFragment) + { + if (navigationFragment == NavigationFragment.Capture && currentTab != CurrentTab.Capture) + { + isMoreToggled.setNoCallback(false); + isMyColorsToggled.setNoCallback(false); + isCaptureToggled.setNoCallback(true); + } + } + + @Override + protected void onViewAttached(IMainActivity view) + { + super.onViewAttached(view); + notificationProvider.showDialog(new WelcomeDialog()); + } + + private void onMyColorsToggled(DependencyProperty<Boolean> booleanDependencyProperty, Boolean value) + { + setCurrentTab(CurrentTab.MyColors); + } + + private void onCaptureToggled(DependencyProperty<Boolean> booleanDependencyProperty, Boolean value) + { + setCurrentTab(CurrentTab.Capture); + } + + private void onMoreToggled(DependencyProperty<Boolean> booleanDependencyProperty, Boolean value) + { + setCurrentTab(CurrentTab.More); + } + + private void setCurrentTab(CurrentTab tab) + { + currentTab = tab; + + if (tab == CurrentTab.More) + { + if (isMoreToggled.get()) + { + isCaptureToggled.setNoCallback(false); + isMyColorsToggled.setNoCallback(false); + } + isMoreToggled.setNoCallback(true); + } + else if (tab == CurrentTab.Capture) + { + if (isCaptureToggled.get()) + { + isMoreToggled.setNoCallback(false); + isMyColorsToggled.setNoCallback(false); + navigationProvider.navigateTo(NavigationFragment.Capture,false); + } + isCaptureToggled.setNoCallback(true); + } + else if (tab == CurrentTab.MyColors) + { + if (isMyColorsToggled.get()) { + isMoreToggled.setNoCallback(false); + isCaptureToggled.setNoCallback(false); + navigationProvider.navigateTo(NavigationFragment.MyColors,false); + } + isMyColorsToggled.setNoCallback(true); + } } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/IMyColorsFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/IMyColorsFragment.java new file mode 100644 index 000000000..27f9c0419 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/IMyColorsFragment.java @@ -0,0 +1,9 @@ +package com.twine.colorcapture.views.mycolors; + +import com.twine.colorcapture.core.IAction1; +import com.twine.colorcapture.mvvm.IView; + +public interface IMyColorsFragment extends IView +{ + +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragment.java new file mode 100644 index 000000000..8df527308 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragment.java @@ -0,0 +1,35 @@ +package com.twine.colorcapture.views.mycolors; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.core.IAction1; +import com.twine.colorcapture.mvvm.FragmentBase; +import com.twine.colorcapture.databinding.FragmentMycolorsBinding; + +public class MyColorsFragment extends FragmentBase<FragmentMycolorsBinding, MyColorsFragmentVM> implements IMyColorsFragment +{ + private IAction1<Boolean> cameraAccessAction; + + public MyColorsFragment() + { + // Required empty public constructor + } + + @Override + protected int getLayoutId() + { + return R.layout.fragment_mycolors; + } + + @Override + protected void inject() + { + App.getComponent().inject(this); + } + + @Override + public String getTitle() + { + return "MyColors"; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java new file mode 100644 index 000000000..9a2358516 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/mycolors/MyColorsFragmentVM.java @@ -0,0 +1,17 @@ +package com.twine.colorcapture.views.mycolors; + +import com.twine.colorcapture.mvvm.ViewModelBase; +import com.twine.colorcapture.navigation.INavigationProvider; + +import javax.inject.Inject; + +public class MyColorsFragmentVM extends ViewModelBase<IMyColorsFragment> +{ + private INavigationProvider navigationProvider; + + @Inject + public MyColorsFragmentVM(INavigationProvider navigationProvider) + { + this.navigationProvider = navigationProvider; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java new file mode 100644 index 000000000..065faf106 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java @@ -0,0 +1,16 @@ +package com.twine.colorcapture.web; + +import android.graphics.Bitmap; + +import com.twine.colorcapture.web.messages.DefinitionResponse; +import com.twine.colorcapture.web.messages.DetectionRequest; +import com.twine.colorcapture.web.messages.DetectionResponse; + +import java.io.IOException; + +public interface ITCCService +{ + DefinitionResponse getDefinition() throws IOException; + + DetectionResponse detect(Bitmap bitmap, String barcode) throws IOException; +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java new file mode 100644 index 000000000..6fa84c556 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java @@ -0,0 +1,25 @@ +package com.twine.colorcapture.web; + +import com.twine.colorcapture.web.messages.DefinitionRequest; +import com.twine.colorcapture.web.messages.DefinitionResponse; +import com.twine.colorcapture.web.messages.DetectionRequest; +import com.twine.colorcapture.web.messages.DetectionResponse; +import com.twine.colorcapture.web.messages.LoginRequest; +import com.twine.colorcapture.web.messages.LoginResponse; + +import io.reactivex.Observable; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +public interface IWebServiceAPI +{ + @POST("ColorDetection/Login") + Call<LoginResponse> login(@Body LoginRequest request); + + @POST("ColorDetection/GetDefinition") + Call<DefinitionResponse> getDefinition(@Body DefinitionRequest request); + + @POST("ColorDetection/Detect") + Call<DetectionResponse> detect(@Body DetectionRequest request); +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java new file mode 100644 index 000000000..98000f3dd --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java @@ -0,0 +1,76 @@ +package com.twine.colorcapture.web; + +import android.graphics.Bitmap; +import android.util.Base64; + +import com.twine.colorcapture.BuildConfig; +import com.twine.colorcapture.utils.BitmapUtils; +import com.twine.colorcapture.web.messages.DefinitionRequest; +import com.twine.colorcapture.web.messages.DefinitionResponse; +import com.twine.colorcapture.web.messages.DetectionRequest; +import com.twine.colorcapture.web.messages.DetectionResponse; +import com.twine.colorcapture.web.messages.LoginRequest; +import com.twine.colorcapture.web.messages.LoginResponse; + +import java.io.IOException; + +import javax.inject.Inject; + +public class TCCService implements ITCCService +{ + private DefinitionResponse definition; + private IWebServiceAPI webAPI; + private LoginResponse loginResponse; + + @Inject + public TCCService(IWebServiceAPI webServiceAPI) + { + this.webAPI = webServiceAPI; + } + + @Override + public DefinitionResponse getDefinition() throws IOException + { + ensureAuthenticated(); + + if (definition == null) + { + definition = webAPI.getDefinition(new DefinitionRequest()).execute().body(); + } + + return definition; + } + + @Override + public DetectionResponse detect(Bitmap bitmap, String barcode) throws IOException + { + ensureAuthenticated(); + + DetectionRequest request = new DetectionRequest(); + + request.setBitmapString(BitmapUtils.getBitmapBase64String(bitmap)); + request.setBarcode(barcode); + + DetectionResponse response = webAPI.detect(request).execute().body(); + + return response; + } + + private void ensureAuthenticated() throws IOException + { + if (loginResponse == null) + { + login(); + } + } + + private LoginResponse login() throws IOException + { + LoginRequest request = new LoginRequest(); + request.setAppId(BuildConfig.WEB_SERVICE_APP_ID); + request.setDeviceId("1234"); + loginResponse = webAPI.login(request).execute().body(); + WebApiFactory.setAuthenticationToken(loginResponse.getAccessToken()); + return loginResponse; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java new file mode 100644 index 000000000..3aeaccd14 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/WebApiFactory.java @@ -0,0 +1,101 @@ +package com.twine.colorcapture.web; + +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import retrofit2.Retrofit; +import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; +import retrofit2.converter.gson.GsonConverterFactory; + + +/** + * Represents the system restful api factory. + */ +public class WebApiFactory +{ + private static String baseUrl; + private static String accessToken; + + + /** + * Initializes the remote base url. + * + * @param base_url the base url + */ + public static void init(String base_url) + { + baseUrl = base_url; + } + + /** + * Gets synchronization api. + * + * @return the synchronization api + */ + public static IWebServiceAPI getWebServiceApi() + { + return createAPI(IWebServiceAPI.class, 60); + } + + /** + * Creates the specified API interface instance. + * @param cls + * @param timeout + * @param <T> + * @return + */ + private static <T> T createAPI(Class<?> cls, int timeout) + { + OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); + httpClient.addInterceptor(new Interceptor() { + @Override + public Response intercept(Chain chain) throws IOException + { + Request request; + + if (accessToken != null) + { + request = chain.request().newBuilder().addHeader("Authorization", accessToken).build(); + } + else + { + request = chain.request().newBuilder().build(); + } + return chain.proceed(request); + } + }); + + httpClient.readTimeout(timeout, TimeUnit.SECONDS); + httpClient.writeTimeout(timeout, TimeUnit.SECONDS); + + Gson gson = new GsonBuilder() + .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) + .setLenient() + .setDateFormat("yyyy-MM-dd") + .create(); + + Retrofit retrofit = new Retrofit.Builder() + .baseUrl(baseUrl) + +// .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + .addConverterFactory(GsonConverterFactory.create(gson)) + .client(httpClient.build()) + .build(); + + return (T) retrofit.create(cls); + } + + public static void setAuthenticationToken(String authenticationToken) + { + accessToken = authenticationToken; + } +} + diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionRequest.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionRequest.java new file mode 100644 index 000000000..2847847b2 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionRequest.java @@ -0,0 +1,5 @@ +package com.twine.colorcapture.web.messages; + +public class DefinitionRequest +{ +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java new file mode 100644 index 000000000..2dde27e09 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DefinitionResponse.java @@ -0,0 +1,105 @@ +package com.twine.colorcapture.web.messages; + +public class DefinitionResponse +{ + private String templateString; + private int sampleWidth; + private int sampleHeight; + private int cameraWidth; + private int cameraHeight; + private int histogramMethod; + private double similarityTolerance; + private boolean enableDoubleChecking; + private boolean enforceBarcodeDetection; + + public String getTemplateString() + { + return templateString; + } + + public void setTemplateString(String templateString) + { + this.templateString = templateString; + } + + public int getSampleWidth() + { + return sampleWidth; + } + + public void setSampleWidth(int sampleWidth) + { + this.sampleWidth = sampleWidth; + } + + public int getSampleHeight() + { + return sampleHeight; + } + + public void setSampleHeight(int sampleHeight) + { + this.sampleHeight = sampleHeight; + } + + public int getCameraWidth() + { + return cameraWidth; + } + + public void setCameraWidth(int cameraWidth) + { + this.cameraWidth = cameraWidth; + } + + public int getCameraHeight() + { + return cameraHeight; + } + + public void setCameraHeight(int cameraHeight) + { + this.cameraHeight = cameraHeight; + } + + public int getHistogramMethod() + { + return histogramMethod; + } + + public void setHistogramMethod(int histogramMethod) + { + this.histogramMethod = histogramMethod; + } + + + public double getSimilarityTolerance() + { + return similarityTolerance; + } + + public void setSimilarityTolerance(double similarityTolerance) + { + this.similarityTolerance = similarityTolerance; + } + + public boolean isEnableDoubleChecking() + { + return enableDoubleChecking; + } + + public void setEnableDoubleChecking(boolean enableDoubleChecking) + { + this.enableDoubleChecking = enableDoubleChecking; + } + + public boolean isEnforceBarcodeDetection() + { + return enforceBarcodeDetection; + } + + public void setEnforceBarcodeDetection(boolean enforceBarcodeDetection) + { + this.enforceBarcodeDetection = enforceBarcodeDetection; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionColor.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionColor.java new file mode 100644 index 000000000..05e2d2c9f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionColor.java @@ -0,0 +1,38 @@ +package com.twine.colorcapture.web.messages; + +public class DetectionColor +{ + private int r; + private int g; + private int b; + + public int getR() + { + return r; + } + + public void setR(int r) + { + this.r = r; + } + + public int getG() + { + return g; + } + + public void setG(int g) + { + this.g = g; + } + + public int getB() + { + return b; + } + + public void setB(int b) + { + this.b = b; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionRequest.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionRequest.java new file mode 100644 index 000000000..5686a6947 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionRequest.java @@ -0,0 +1,27 @@ +package com.twine.colorcapture.web.messages; + +public class DetectionRequest +{ + private String bitmapString; + private String barcode; + + public String getBitmapString() + { + return bitmapString; + } + + public void setBitmapString(String bitmapString) + { + this.bitmapString = bitmapString; + } + + public String getBarcode() + { + return barcode; + } + + public void setBarcode(String barcode) + { + this.barcode = barcode; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionResponse.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionResponse.java new file mode 100644 index 000000000..2e33a04b5 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/DetectionResponse.java @@ -0,0 +1,27 @@ +package com.twine.colorcapture.web.messages; + +public class DetectionResponse +{ + private DetectionColor rawColor; + private DetectionColor processedColor; + + public DetectionColor getRawColor() + { + return rawColor; + } + + public void setRawColor(DetectionColor rawColor) + { + this.rawColor = rawColor; + } + + public DetectionColor getProcessedColor() + { + return processedColor; + } + + public void setProcessedColor(DetectionColor processedColor) + { + this.processedColor = processedColor; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/LoginRequest.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/LoginRequest.java new file mode 100644 index 000000000..c49dcafe8 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/LoginRequest.java @@ -0,0 +1,49 @@ +package com.twine.colorcapture.web.messages; + +public class LoginRequest +{ + private String appId; + private String device; + private String deviceId; + private String osVersion; + + public String getAppId() + { + return appId; + } + + public void setAppId(String appId) + { + this.appId = appId; + } + + public String getDevice() + { + return device; + } + + public void setDevice(String device) + { + this.device = device; + } + + public String getDeviceId() + { + return deviceId; + } + + public void setDeviceId(String deviceId) + { + this.deviceId = deviceId; + } + + public String getOsVersion() + { + return osVersion; + } + + public void setOsVersion(String osVersion) + { + this.osVersion = osVersion; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/LoginResponse.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/LoginResponse.java new file mode 100644 index 000000000..4c719f32e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/LoginResponse.java @@ -0,0 +1,16 @@ +package com.twine.colorcapture.web.messages; + +public class LoginResponse +{ + private String accessToken; + + public String getAccessToken() + { + return accessToken; + } + + public void setAccessToken(String accessToken) + { + this.accessToken = accessToken; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/anim/zoom_in.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/anim/zoom_in.xml new file mode 100644 index 000000000..d6b3668d3 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/anim/zoom_in.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/decelerate_interpolator"> + <scale android:fromXScale="2.0" android:toXScale="1.0" + android:fromYScale="2.0" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> +</set>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/anim/zoom_out.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/anim/zoom_out.xml new file mode 100644 index 000000000..02008bb2a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/anim/zoom_out.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:anim/decelerate_interpolator" + android:zAdjustment="top"> + <scale android:fromXScale="1.0" android:toXScale=".5" + android:fromYScale="1.0" android:toYScale=".5" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:duration="@android:integer/config_mediumAnimTime"/> +</set>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/darkening.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/darkening.png Binary files differnew file mode 100644 index 000000000..a18946b8e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/darkening.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/logo.png Binary files differnew file mode 100644 index 000000000..d603442d6 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/more_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..8f8c4e153 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/more_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/more_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..28b678a74 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/more_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/my_colors.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..64433b097 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/my_colors.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/selected.png Binary files differnew file mode 100644 index 000000000..59b34c80f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..33849c970 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_logo.png Binary files differnew file mode 100644 index 000000000..bad8273ba --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twine_logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twinesnap_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..79705e9ca --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twinesnap_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twinesnap_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..3ca5bf9b7 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-hdpi/twinesnap_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/darkening.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/darkening.png Binary files differnew file mode 100644 index 000000000..58cf40d6a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/darkening.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/logo.png Binary files differnew file mode 100644 index 000000000..d9dc2cf15 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/more_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..6c8ce0b9a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/more_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/more_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..179384dd0 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/more_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/my_colors.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..c38fbefc1 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/my_colors.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/selected.png Binary files differnew file mode 100644 index 000000000..0a5041bb9 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..1b77e264e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_logo.png Binary files differnew file mode 100644 index 000000000..0c56ba31b --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twine_logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twinesnap_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..3999dfb84 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twinesnap_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twinesnap_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..6bd9f3638 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-mdpi/twinesnap_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/darkening.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/darkening.png Binary files differnew file mode 100644 index 000000000..f50441f22 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/darkening.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/logo.png Binary files differnew file mode 100644 index 000000000..f6b3bf9be --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/more_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..a540c41be --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/more_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/more_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..60494cce8 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/more_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/my_colors.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..2eae175fd --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/my_colors.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/selected.png Binary files differnew file mode 100644 index 000000000..e1aa19889 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..4eb5dc787 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_logo.png Binary files differnew file mode 100644 index 000000000..9009dd34a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twine_logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twinesnap_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..bf6509ea2 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twinesnap_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twinesnap_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..f71ff6ea5 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xhdpi/twinesnap_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/darkening.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/darkening.png Binary files differnew file mode 100644 index 000000000..ff47c2bd1 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/darkening.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/logo.png Binary files differnew file mode 100644 index 000000000..fe384b6dd --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/more_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..edbed5b5e --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/more_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/more_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..263622f94 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/more_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/my_colors.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..1570ddb97 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/my_colors.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/selected.png Binary files differnew file mode 100644 index 000000000..6c4d944f2 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..d095059bb --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_logo.png Binary files differnew file mode 100644 index 000000000..ce0f15c34 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twine_logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twinesnap_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..6b098152f --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twinesnap_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twinesnap_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..94e490595 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxhdpi/twinesnap_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/darkening.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/darkening.png Binary files differnew file mode 100644 index 000000000..d55bc070d --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/darkening.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/logo.png Binary files differnew file mode 100644 index 000000000..b173a3c86 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/more_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..1f009161c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/more_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/more_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..80b2611cf --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/more_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/my_colors.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..b816454ed --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/my_colors.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/selected.png Binary files differnew file mode 100644 index 000000000..705b88dfe --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_card.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..857f83930 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_card.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_logo.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_logo.png Binary files differnew file mode 100644 index 000000000..d9ff791bc --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twine_logo.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twinesnap_normal.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..f48411cb9 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twinesnap_normal.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twinesnap_selected.png b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..3741bdb4a --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable-xxxhdpi/twinesnap_selected.png diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/accent_gradient.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/accent_gradient.xml new file mode 100644 index 000000000..3af99e137 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/accent_gradient.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:type="linear" + android:angle="0" + android:startColor="#26d440" + android:endColor="#009fe3" /> +</shape>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/background_gradient.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/background_gradient.xml new file mode 100644 index 000000000..9a95bd708 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/background_gradient.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:type="linear" + android:angle="270" + android:startColor="@color/colorPrimaryBackground" + android:endColor="#07101e" /> +</shape>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/border.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/border.xml new file mode 100644 index 000000000..2f0177da9 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/border.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + + <corners android:radius="5dp" /> + <stroke android:width="2px" android:color="#E2E2E2"/> + +</shape>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/border_shadow.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/border_shadow.xml new file mode 100644 index 000000000..cf3d424af --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/border_shadow.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <layer-list> + <item> + <shape android:shape="rectangle"> + <solid android:color="#54000000"/> + <corners android:radius="2dp" /> + </shape> + </item> + <item android:bottom="5dp"> + <shape android:shape="rectangle"> + <solid android:color="@color/colorPrimaryBackground"/> + <corners android:radius="2dp" /> + </shape> + </item> + </layer-list> + </item> +</selector>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/button_gradient_fill.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/button_gradient_fill.xml new file mode 100644 index 000000000..479e0a5ab --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/button_gradient_fill.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + + <gradient + android:startColor="#26d440" + android:endColor="#009fe3" + android:angle="0"/> + + <corners android:radius="30dp" /> + +</shape>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/button_gradient_fill_ripple.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/button_gradient_fill_ripple.xml new file mode 100644 index 000000000..7cafa1d09 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/button_gradient_fill_ripple.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="@color/colorBlueMask"> + <item android:drawable="@drawable/button_gradient_fill"/> +</ripple>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/dialog_background.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/dialog_background.xml new file mode 100644 index 000000000..d05e8d3d2 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/dialog_background.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + + <solid android:color="@color/colorPrimaryBackground"/> + <corners android:radius="10dp" /> + +</shape>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/welcome_dialog_border.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/welcome_dialog_border.xml new file mode 100644 index 000000000..524641801 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/drawable/welcome_dialog_border.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + + <solid android:color="@color/colorWhiteMask"/> + <stroke android:color="#4C5070" android:width="1dp" /> + <corners android:radius="5dp" /> + +</shape>
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_black.otf b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_black.otf Binary files differnew file mode 100644 index 000000000..0341d05db --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_black.otf diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_bold.otf b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_bold.otf Binary files differnew file mode 100644 index 000000000..2b9144e5c --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_bold.otf diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_light.otf b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_light.otf Binary files differnew file mode 100644 index 000000000..27af39094 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_light.otf diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_medium.otf b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_medium.otf Binary files differnew file mode 100644 index 000000000..04b2a8853 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_medium.otf diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_regular.otf b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_regular.otf Binary files differnew file mode 100644 index 000000000..2703ba3f3 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_regular.otf diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_thin.otf b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_thin.otf Binary files differnew file mode 100644 index 000000000..666c69931 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/font/flexo_thin.otf diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_loading.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_loading.xml new file mode 100644 index 000000000..8ab79ffe2 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_loading.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> + +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:bind="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <data> + + <variable + name="vm" + type="com.twine.colorcapture.views.loading.LoadingActivityVM" /> + </data> + + <FrameLayout + android:background="@drawable/background_gradient" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="ltr" + android:paddingLeft="40dp" + android:paddingRight="40dp" + tools:context="com.twine.colorcapture.views.loading.LoadingActivity"> + + + <!--<TextView--> + <!--android:id="@+id/textView"--> + <!--android:layout_width="wrap_content"--> + <!--android:layout_height="wrap_content"--> + <!--android:layout_centerHorizontal="true"--> + <!--android:layout_centerVertical="true"--> + <!--android:text="Loading..."--> + <!--android:textSize="21sp" />--> + + <!--<ProgressBar--> + <!--android:id="@+id/progressBar"--> + <!--style="@android:style/Widget.ProgressBar.Horizontal"--> + <!--android:layout_width="301dp"--> + <!--android:layout_height="22dp"--> + <!--android:layout_below="@+id/textView"--> + <!--android:layout_marginTop="15dp"--> + <!--android:layout_centerHorizontal="true"--> + <!--android:max="2000"--> + <!--android:progress="@{vm.loadingProgress}"--> + <!--android:progressDrawable="@drawable/gradient_progressbar" />--> + <ImageView + android:id="@+id/imageView2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:layout_centerHorizontal="true" + android:src="@drawable/twine_logo" /> + </RelativeLayout> + + </FrameLayout> +</layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml index 1d7d77ad4..d2e2f89c1 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml @@ -21,60 +21,64 @@ <RelativeLayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/colorPrimaryBackground" tools:context="com.twine.colorcapture.views.main.MainActivity"> <LinearLayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="80dp" - android:background="@android:color/darker_gray" + android:background="@color/colorPrimaryBackground" android:gravity="center_vertical" + android:elevation="20dp" android:orientation="horizontal" - android:visibility="gone"> + android:visibility="visible"> - <Space - android:layout_width="0dp" - android:layout_height="1dp" - android:layout_weight="1" /> - - <Button + <com.twine.colorcapture.controls.ToggleImageButton android:id="@+id/btnMenu" android:layout_width="68dp" android:layout_height="65dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" - android:text="Menu" /> + android:layout_marginLeft="20dp" + android:background="@color/colorTransparent" + bind:normalImage="@drawable/more_normal" + bind:checkedImage="@drawable/more_selected" + bind:checked="@={vm.isMoreToggled}"/> <Space android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /> - <ImageButton + <com.twine.colorcapture.controls.ToggleImageButton android:id="@+id/imageButton2" android:layout_width="68dp" android:layout_height="65dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" - bind:srcCompat="@drawable/onboarding_pager_circle_icon" /> + android:background="@color/colorTransparent" + bind:normalImage="@drawable/twinesnap_normal" + bind:checkedImage="@drawable/twinesnap_selected" + bind:checked="@={vm.isCaptureToggled}"/> <Space android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /> - <ImageButton + <com.twine.colorcapture.controls.ToggleImageButton android:id="@+id/imageButton3" android:layout_width="68dp" android:layout_height="65dp" + android:layout_marginRight="20dp" android:layout_alignParentStart="true" android:layout_centerVertical="true" - bind:srcCompat="@drawable/onboarding_pager_circle_icon" /> - - <Space - android:layout_width="0dp" - android:layout_height="1dp" - android:layout_weight="1" /> + android:background="@color/colorTransparent" + bind:normalImage="@drawable/my_colors" + bind:checkedImage="@drawable/selected" + bind:checked="@={vm.isMyColorsToggled}" + /> </LinearLayout> <FrameLayout diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_welcome.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_welcome.xml new file mode 100644 index 000000000..cacc97715 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/dialog_welcome.xml @@ -0,0 +1,104 @@ +<layout xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:bind="http://schemas.android.com/apk/res-auto"> + + <data> + <variable + name="vm" + type="com.twine.colorcapture.dialogs.welcome.WelcomeDialogVM" /> + </data> + + <RelativeLayout + android:layoutDirection="ltr" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.twine.colorcapture.dialogs.welcome.WelcomeDialog"> + + <RelativeLayout + android:id="@+id/frameLayout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/welcome_dialog_border" + android:foregroundGravity="center" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:layout_marginTop="50dp" + android:layout_marginBottom="100dp"> + + + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/textView" + android:textColor="#ffffff" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_margin="30dp" + android:textSize="17.3sp" + android:textStyle="bold" + android:fontFamily="@font/flexo_bold" + android:text="@string/welcome_title" /> + + <ImageView + android:id="@+id/imageView3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/textView" + android:layout_alignParentTop="false" + android:layout_centerHorizontal="true" + android:src="@drawable/twine_card" /> + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/textView2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/imageView3" + android:layout_centerHorizontal="true" + android:layout_marginStart="20dp" + android:layout_marginTop="20dp" + android:layout_marginEnd="20dp" + android:gravity="center" + android:textSize="15.4sp" + android:letterSpacing="0.08" + android:lineSpacingExtra="7.7sp" + android:fontFamily="@font/flexo_regular" + android:text="@string/welcome_message" + android:singleLine="false" + android:textAlignment="center" /> + + </RelativeLayout> + + <android.support.v7.widget.AppCompatButton + android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="55dp" + android:layout_alignBottom="@+id/frameLayout" + android:layout_centerHorizontal="true" + android:layout_marginBottom="-30dp" + android:background="@drawable/button_gradient_fill_ripple" + android:paddingStart="70dp" + android:paddingEnd="70dp" + android:textSize="15.4sp" + android:letterSpacing="0.07" + android:textStyle="bold" + android:text="@string/welcome_go_button" + android:fontFamily="@font/flexo_bold" + bind:command="@{vm.startCommand}" + android:textAllCaps="false" /> + + <android.support.v7.widget.AppCompatTextView + android:id="@+id/textView3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/button" + android:layout_centerHorizontal="true" + android:layout_marginTop="50dp" + android:textSize="15.4sp" + android:textColor="#ffffff" + android:fontFamily="@font/flexo_bold" + android:letterSpacing="0.09" + android:text="@string/welcome_have_a_twine_card_message" /> + + </RelativeLayout> +</layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_capture.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_capture.xml index 7f8e470d0..a175b87d2 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_capture.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_capture.xml @@ -41,7 +41,7 @@ android:layout_alignParentBottom="true" android:layout_marginEnd="22dp" android:layout_marginBottom="28dp" - app:srcCompat="@android:color/black" /> + app:srcCompat="@android:color/black" android:visibility="gone" /> </RelativeLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" @@ -51,7 +51,7 @@ <View android:layout_width="match_parent" - android:layout_height="100dp" + android:layout_height="30dp" android:background="#9A000000" /> @@ -68,7 +68,7 @@ android:layout_alignParentStart="true" android:background="#9A000000" /> - <LinearLayout + <FrameLayout android:id="@+id/scannerLayout" android:layout_width="wrap_content" android:layout_height="match_parent" @@ -77,17 +77,19 @@ android:layout_toLeftOf="@id/right" android:layout_toRightOf="@id/left" android:layout_toStartOf="@+id/right" - android:background="@drawable/ic_viewfinder" + android:background="@drawable/border" android:orientation="horizontal"> <View android:id="@+id/scannerBar" android:layout_width="match_parent" + android:layout_marginTop="5dp" + android:layout_marginBottom="5dp" android:layout_height="5dp" android:background="@color/colorPrimary" /> - </LinearLayout> + </FrameLayout> <View @@ -100,10 +102,21 @@ </RelativeLayout> - <View + <FrameLayout android:layout_width="match_parent" android:layout_height="100dp" - android:background="#9A000000" /> + android:background="#9A000000" + android:paddingLeft="40dp" + android:paddingRight="40dp"> + + <android.support.v7.widget.AppCompatTextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:textSize="13.4sp" + android:fontFamily="@font/flexo_medium" + android:text="@string/twine_snap_message" /> + </FrameLayout> </LinearLayout> </FrameLayout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_loading.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_loading.xml deleted file mode 100644 index 21fbf6485..000000000 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_loading.xml +++ /dev/null @@ -1,57 +0,0 @@ -<layout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:bind="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools"> - - <data> - - <variable - name="vm" - type="com.twine.colorcapture.views.loading.LoadingFragmentVM" /> - </data> - - <FrameLayout - android:background="#000000" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:scaleType="fitXY" - bind:srcCompat="@drawable/loading_background_brush" /> - - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layoutDirection="ltr" - android:paddingLeft="40dp" - android:paddingRight="40dp" - tools:context="com.twine.colorcapture.views.loading.LoadingFragment"> - - - <TextView - android:id="@+id/textView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:layout_centerVertical="true" - android:text="Loading..." - android:textSize="21sp" /> - - <ProgressBar - android:id="@+id/progressBar" - style="@android:style/Widget.ProgressBar.Horizontal" - android:layout_width="301dp" - android:layout_height="22dp" - android:layout_below="@+id/textView" - android:layout_marginTop="15dp" - android:layout_centerHorizontal="true" - android:max="2000" - android:progress="@{vm.loadingProgress}" - android:progressDrawable="@drawable/gradient_progressbar" /> - </RelativeLayout> - - </FrameLayout> -</layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_home.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_mycolors.xml index f62a2f6f2..edc10f2ce 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_home.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/fragment_mycolors.xml @@ -6,7 +6,7 @@ <data> <variable name="vm" - type="com.twine.colorcapture.views.home.HomeFragmentVM" /> + type="com.twine.colorcapture.views.mycolors.MyColorsFragmentVM" /> </data> <RelativeLayout @@ -15,7 +15,7 @@ android:layout_height="match_parent" android:paddingLeft="40dp" android:paddingRight="40dp" - tools:context="com.twine.colorcapture.views.home.HomeFragment"> + tools:context="com.twine.colorcapture.views.mycolors.MyColorsFragment"> <TextView @@ -24,19 +24,19 @@ android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" - android:text="Home View" + android:text="My Colors" android:textSize="30sp" - tools:text="Home View" /> + tools:text="My Colors" /> - <Button - android:id="@+id/btnStart" - android:layout_width="150dp" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" - android:layout_marginBottom="36dp" - android:text="Start" - bind:command="@{vm.startCaptureCommand}" /> + <!--<Button--> + <!--android:id="@+id/btnStart"--> + <!--android:layout_width="150dp"--> + <!--android:layout_height="wrap_content"--> + <!--android:layout_alignParentBottom="true"--> + <!--android:layout_centerHorizontal="true"--> + <!--android:layout_marginBottom="36dp"--> + <!--android:text="Start"--> + <!--bind:command="@{vm.startCaptureCommand}" />--> </RelativeLayout> </layout> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml index 07b373724..9921a92a5 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml @@ -30,7 +30,7 @@ android:adjustViewBounds="true" android:background="@color/colorPrimaryDark" android:scaleType="fitXY" - app:srcCompat="@drawable/hand_phone" /> + android:src="@drawable/hand_phone" /> <TextView android:id="@+id/txtUserName" diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/values/colors.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/values/colors.xml index 451d7b6f1..d6c70f6c7 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/values/colors.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/values/colors.xml @@ -8,4 +8,9 @@ <color name="colorMask">#BB000000</color> <color name="colorTransparent">#00000000</color> + + <color name="colorPrimaryBackground">#0e2340</color> + + <color name="colorBlueMask">#EB09172A</color> + <color name="colorWhiteMask">#B71D3150</color> </resources> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml index 8e5e37080..841774671 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/values/strings.xml @@ -3,4 +3,12 @@ <!-- TODO: Remove or change this placeholder text --> <string name="hello_blank_fragment">Hello blank fragment</string> + + <string name="twine_snap_message">Place your Twine TCC™ card on the object you want to color match</string> + <string name="welcome_title">Welcome to twine</string> + <string name="welcome_message"> + <![CDATA[Place your Twine TCC™ card on the object you want to color match. \n\n Make sure that the card is inside the mark…]]> + </string> + <string name="welcome_go_button">Let\'s start!</string> + <string name="welcome_have_a_twine_card_message"><u>Don’t have a Twine TCC™ card?</u></string> </resources> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml index 743fe092c..10dfcc040 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/values/styles.xml @@ -1,6 +1,16 @@ <resources> + <style name="WindowAnimationTransition"> + <item name="android:windowEnterAnimation">@android:anim/fade_in</item> + <item name="android:windowExitAnimation">@android:anim/fade_out</item> + </style> + <style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> + + <!-- enable window content transitions --> + <!--<item name="android:windowActivityTransitions">true</item>--> + <!--<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>--> + <!-- Customize your theme here. --> <!--<item name="colorPrimary">@color/colorPrimary</item>--> <!--<item name="colorPrimaryDark">@color/colorPrimaryDark</item>--> @@ -9,4 +19,10 @@ </style> + <declare-styleable name="ToggleImageButton"> + <attr name="android:checked" /> + <attr name="normalImage" format="reference" /> + <attr name="checkedImage" format="reference" /> + </declare-styleable> + </resources> diff --git a/Software/Android_Studio/ColorCapture/build.gradle b/Software/Android_Studio/ColorCapture/build.gradle index 8d3ef8e5c..23b43f134 100644 --- a/Software/Android_Studio/ColorCapture/build.gradle +++ b/Software/Android_Studio/ColorCapture/build.gradle @@ -19,6 +19,9 @@ allprojects { repositories { google() jcenter() + maven { + url "https://jitpack.io" + } } } diff --git a/Software/Android_Studio/settings.jar b/Software/Android_Studio/settings.jar Binary files differnew file mode 100644 index 000000000..3646d910b --- /dev/null +++ b/Software/Android_Studio/settings.jar diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf Binary files differindex f73a45d63..afd2508ab 100644 --- a/Software/DB/TCC/TCC.mdf +++ b/Software/DB/TCC/TCC.mdf diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf Binary files differindex 53fbaa5d0..6f82f9552 100644 --- a/Software/DB/TCC/TCC_log.ldf +++ b/Software/DB/TCC/TCC_log.ldf diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex dabd1f7ea..54398c293 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex ee3cad182..bd1040fc0 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index 030c4229e..0ef6a93b0 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,3,8,3}; +TangoVersion_t _gTangoVersion = {1,3,8,41}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index b0c063a5e..70f910efb 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -132,14 +132,15 @@ void receive_callback(char* buffer, size_t length) return; // HeatingTestSendResonse(0, false,true,true, /*OriginalMotorSpd_2PPS[index]*/length,requestContainer->type,0,0, "Container"); if (requestContainer->type != MESSAGE_TYPE__KeepAliveRequest) //user action resets the idle counter + { resetIdleCounter(); - + REPORT_MSG(requestContainer->type,"Message received"); + } msgId[index] = requestContainer->type; Length[index] = length; DataLength[index] = requestContainer->data.len; if (index++>=MAX_CONT_LOG) index = 0; - //REPORT_MSG(requestContainer->type,"Message received"); switch(requestContainer->type) { case MESSAGE_TYPE__CalculateRequest: diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h index 614f2affa..367dc0373 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h @@ -1135,7 +1135,7 @@ typedef union { bool F1_GPO_WASTECH_PUMP2 : 1; //0 bool F1_GPO_WHS_WTANKPUMP2 : 1; //1 - bool F1_GPO_DILUTORPUMP_SSR10_CTRL : 1; //2 + bool F1_GPO_DYEINGH_SSR10_CTRL : 1; //2 F1_GPO_DILUTORPUMP_SSR10_CTRL bool DRYER_FAN_TORQUE_PWM : 1; //3 F1_GPO_EXTWINDER_3 bool DRYER_FAN_DIRECT : 1; //4 F1_GPO_EXTWINDER_2 bool DRYER_FAN_ON : 1; //5 F1_GPO_EXTWINDER_1 @@ -1279,23 +1279,43 @@ typedef union */ //------------------------------------ SSR ---------------------------------------- +/* updated 10-04-2019 + + # SSR TYPE USE + ----------------------------------------- + 1 SSR1 AC Dryer Heater Zone-1 + 2 SSR2 AC Dryer Heaters Zone-2 + 3 SSR3 DC Cleaner Pump (Ready for field upgrade) + 4 SSR4 DC Mixer Chip Heater + 5 SSR5 DC Dye Head Heaters Zone-4 + 6 SSR6 DC Dye Head Heaters Zone-3 + 7 SSR7 DC Dye Head Heaters Zone-2 + 8 SSR8 DC Dye Head Heaters Zone-1 + 9 SSR9 DC WHS DX Cooler + 10 SSR10 DC Dye Head Heaters Zone-5 + 11 SSR11 DC Dye Head Heaters Zone-6 + 12 SSR12 DC ------------ + 13 SSR13 DC Dye Head Electromagnet + +*/ + //F2_CTRL -#define SPARE_SSR13_CTRL BIT0 -#define SPARE_SSR12_CTRL BIT1 -#define CHILLER_SSR9_CTRL BIT2 -#define DYEINGH_SSR8_CTRL BIT3 -#define DYEINGH_SSR7_CTRL BIT4 -#define DYEINGH_SSR6_CTRL BIT5 -#define DYEINGH_SSR5_CTRL BIT6 -#define MIXCHIP_SSR4_CTRL BIT7 -#define DRYER_SSR3_CTRL BIT8 -#define DRYER_SSR2_CTRL BIT9 -#define DRYER_SSR1_CTRL BIT10 -#define PDOWN_RL1_CTRL BIT11 -#define RESERVE_BIT12 BIT12 -#define RESERVE_BIT13 BIT13 -#define RESERVE_BIT14 BIT14 -#define RESERVE_BIT15 BIT15 +#define SPARE_SSR13_CTRL BIT0 +#define SPARE_SSR12_CTRL BIT1 +#define CHILLER_SSR9_CTRL BIT2 +#define DYEINGH_SSR8_CTRL BIT3 +#define DYEINGH_SSR7_CTRL BIT4 +#define DYEINGH_SSR6_CTRL BIT5 +#define DYEINGH_SSR5_CTRL BIT6 +#define MIXCHIP_SSR4_CTRL BIT7 +#define CLEANER_PUMP_SSR3_CTRL BIT8 //DRYER_SSR3_CTRL +#define DRYER_SSR2_CTRL BIT9 +#define DRYER_SSR1_CTRL BIT10 +#define PDOWN_RL1_CTRL BIT11 +#define RESERVE_BIT12 BIT12 +#define RESERVE_BIT13 BIT13 +#define RESERVE_BIT14 BIT14 +#define RESERVE_BIT15 BIT15 //F1_gpo_01 #define DYEINGH_SSR10_CTRL BIT2 //HeadHeaterZ5 @@ -1310,22 +1330,22 @@ typedef union { struct { - bool F2_GPO_SPARE_SSR13_CTRL : 1; //0 - bool F2_GPO_SPARE_SSR12_CTRL : 1; //1 - bool F2_GPO_CHILLER_SSR9_CTRL : 1; //2 - bool F2_GPO_DYEINGH_SSR8_CTRL : 1; //3 - bool F2_GPO_DYEINGH_SSR7_CTRL : 1; //4 - bool F2_GPO_DYEINGH_SSR6_CTRL : 1; //5 - bool F2_GPO_DYEINGH_SSR5_CTRL : 1; //6 - bool F2_GPO_MIXCHIP_SSR4_CTRL : 1; //7 - bool F2_GPO_DRYER_SSR3_CTRL : 1; //8 - bool F2_GPO_DRYER_SSR2_CTRL : 1; //9 - bool F2_GPO_DRYER_SSR1_CTRL : 1; //10 - bool F2_GPO_PDOWN_RL1_CTRL : 1; //11 - bool F2_GPO_RESERVE_BIT12 : 1; //12 - bool F2_GPO_RESERVE_BIT13 : 1; //13 - bool F2_GPO_RESERVE_BIT14 : 1; //14 - bool F2_GPO_RESERVE_BIT15 : 1; //15 + bool F2_GPO_SPARE_SSR13_CTRL : 1; //0 + bool F2_GPO_SPARE_SSR12_CTRL : 1; //1 + bool F2_GPO_CHILLER_SSR9_CTRL : 1; //2 + bool F2_GPO_DYEINGH_SSR8_CTRL : 1; //3 + bool F2_GPO_DYEINGH_SSR7_CTRL : 1; //4 + bool F2_GPO_DYEINGH_SSR6_CTRL : 1; //5 + bool F2_GPO_DYEINGH_SSR5_CTRL : 1; //6 + bool F2_GPO_MIXCHIP_SSR4_CTRL : 1; //7 + bool F2_GPO_CLEANER_PUMP_SSR3_CTRL : 1; //8 F2_GPO_DRYER_SSR3_CTRL + bool F2_GPO_DRYER_SSR2_CTRL : 1; //9 + bool F2_GPO_DRYER_SSR1_CTRL : 1; //10 + bool F2_GPO_PDOWN_RL1_CTRL : 1; //11 + bool F2_GPO_RESERVE_BIT12 : 1; //12 + bool F2_GPO_RESERVE_BIT13 : 1; //13 + bool F2_GPO_RESERVE_BIT14 : 1; //14 + bool F2_GPO_RESERVE_BIT15 : 1; //15 }bits; unsigned short ushort; }F2_CTRL_REG; diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index a268ad0d5..f88438bd0 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -429,17 +429,17 @@ bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch) //----------------------------------------------------------------------------------------------- -uint32_t ActivateDilutorPump() +uint32_t ActivateCleanerPump() { - F2_CTRL_Reg.ushort |= CHILLER_SSR9_CTRL; + F2_CTRL_Reg.ushort |= CLEANER_PUMP_SSR3_CTRL; F2_CTRL = F2_CTRL_Reg.ushort; return OK; } -uint32_t DeActivateDilutorPump() +uint32_t DeActivateCleanerPump() { - F2_CTRL_Reg.ushort &= ~CHILLER_SSR9_CTRL; + F2_CTRL_Reg.ushort &= ~CLEANER_PUMP_SSR3_CTRL; F2_CTRL = F2_CTRL_Reg.ushort; return OK; } @@ -460,16 +460,16 @@ void Power_Reset()// Resets the MCU //-------------------------------------- -uint32_t ActivateChiller() +uint32_t ActivateChiller() //WHS Cooler / WHS DX Cooler { - F2_CTRL_Reg.ushort |= SPARE_SSR12_CTRL; + F2_CTRL_Reg.ushort |= CHILLER_SSR9_CTRL; F2_CTRL = F2_CTRL_Reg.ushort; return OK; } -uint32_t DeActivateChiller() +uint32_t DeActivateChiller() //WHS Cooler / WHS DX Cooler { - F2_CTRL_Reg.ushort &= ~SPARE_SSR12_CTRL; + F2_CTRL_Reg.ushort &= ~CHILLER_SSR9_CTRL; F2_CTRL = F2_CTRL_Reg.ushort; return OK; } @@ -500,6 +500,7 @@ uint32_t DeActivateAllSSR() { F2_CTRL_Reg.ushort = 0; F2_CTRL = F2_CTRL_Reg.ushort; + //TODO add SSR10 - 11 return OK; } diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h index 409f75418..b7327f0e3 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h @@ -183,8 +183,8 @@ void Read_FPGA_GPI_Rgisters(); bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch); void FPGA_Read_LS_Safty_Ind_Reg(); -uint32_t ActivateDilutorPump(); -uint32_t DeActivateDilutorPump(); +uint32_t ActivateCleanerPump(); +uint32_t DeActivateCleanerPump(); void Power_Off(); void Power_Reset(); //uint8_t Buttons_LEDS(BUTTON Button, OPERATION_MODE LED_Mode); diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c index 14c548f2a..89b9be968 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c @@ -44,7 +44,7 @@ extern F3_GPO_01_REG F3_GPO_01_Reg; static GPIOIntPortMap portMap[MAX_HEATERS_NUM] = { - {DRYER_SSR3_CTRL, false}, // HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature **** Not connected **** + {SPARE_SSR12_CTRL, false}, // Spare {DRYER_SSR1_CTRL, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain {DRYER_SSR2_CTRL, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary {DYEINGH_SSR8_CTRL, false}, // HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1 - Head Heater #1 - rightmost diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index 046f8291e..ba2f049ad 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -185,7 +185,7 @@ int main(void) #ifndef EVALUATION_BOARD //Turn_the_Blower_On();//Turn on with the Default_Voltage - ActivateChiller();//SSR12 + ActivateChiller();//WHS Cooler SSR9 //ActivateHeadMagnet(); #endif diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 81c4a230b..13f0515f9 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -685,9 +685,12 @@ void AlarmHandlingInternalSetAlarm(uint32_t AlarmId, bool value) else { Report("Alarm OFF ", __FILE__,__LINE__,AlarmItem[Alarm_i].EventType, RpMessage, value, Alarm_i); - AlarmState[Alarm_i].Status = value; if (AlarmState[Alarm_i].EventPtr) + { my_free(AlarmState[Alarm_i].EventPtr); + AlarmState[Alarm_i].EventPtr = NULL; + } + AlarmState[Alarm_i].Status = value; } } break; @@ -735,7 +738,7 @@ uint32_t AlarmHandlingLoop(uint32_t tick) switch (AlarmItem[Alarm_i].AlarmSource) { /*case ALARM_SOURCE_TYPE__TemperatureAlarm: - ivalue = TemperatureSensorRead((TEMPERATURE_SENSOR_ID_ENUM)AlarmItem[Alarm_i].DeviceId); + ivalue = MillisecGetTemperatures((TEMPERATURE_SENSOR_ID_ENUM)AlarmItem[Alarm_i].DeviceId); if (AlarmItem[Alarm_i].AlarmDirection == true) { if (ivalue/100 >= AlarmItem[Alarm_i].AlarmValue) diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index d34ac9ff9..193769265 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -445,6 +445,37 @@ uint32_t MillisecLoop(uint32_t tick) #endif return OK; } +int TemperatureSum[MAX_TEMPERATURE_SENSOR_ID]; +int TemperatureMin[MAX_TEMPERATURE_SENSOR_ID]; +int TemperatureMax[MAX_TEMPERATURE_SENSOR_ID]; +int TemperatureCount[MAX_TEMPERATURE_SENSOR_ID]; +int TemperatureCalc[MAX_TEMPERATURE_SENSOR_ID]; +void MillisecUpdateTemperatures (TEMPERATURE_SENSOR_ID_ENUM SensorId,int temperature) +{ + //if(TemperatureCount[SensorId]++>=10) + // TemperatureCount[SensorId] = 0; + TemperatureCount[SensorId]++; + if (TemperatureMax[SensorId]<temperature) TemperatureMax[SensorId]=temperature; + if (TemperatureMin[SensorId]>temperature) TemperatureMin[SensorId]=temperature; + TemperatureSum[SensorId]+=temperature; +} +int MillisecCalculateTemperatures (TEMPERATURE_SENSOR_ID_ENUM SensorId) +{ + int calc = 0; + TemperatureSum[SensorId]-=TemperatureMax[SensorId]; + TemperatureSum[SensorId]-=TemperatureMin[SensorId]; + calc = TemperatureSum[SensorId] / (TemperatureCount[SensorId]-2); + + TemperatureSum[SensorId] = 0; + TemperatureCount[SensorId] = 0; + TemperatureMin[SensorId] = 30000; + TemperatureMax[SensorId] = -30000; + return calc; +} +int MillisecGetTemperatures (TEMPERATURE_SENSOR_ID_ENUM SensorId) +{ + return TemperatureCalc[SensorId]; +} uint32_t MillisecLowLoop(uint32_t tick) { uint8_t Motor_i,Disp_i,Heater_i,temp; @@ -454,9 +485,10 @@ uint32_t MillisecLowLoop(uint32_t tick) //call all modules Millisec functions //test dancers and speed encoders //check all callback units (state machine waiting for completion of a change) - bool Ten_msTick, Hundred_msTick, Onesecond_Tick,O900Millisecond_Tick,OneMinute_Tick; + bool Ten_msTick, Hundred_msTick , m90msecTick, Onesecond_Tick,O900Millisecond_Tick,OneMinute_Tick; Ten_msTick = (tick%eTenMillisecond == 0) ?true:false; Hundred_msTick = (tick%eHundredMillisecond == 0) ?true:false; + m90msecTick = (tick%eHundredMillisecond == 90) ?true:false; O900Millisecond_Tick = (tick%eOneSecond == 900) ?true:false; Onesecond_Tick = (tick%eOneSecond == 0) ?true:false; OneMinute_Tick = (tick%eOneMinute == 0) ?true:false; @@ -471,13 +503,20 @@ uint32_t MillisecLowLoop(uint32_t tick) if(Machine_Idle_Mode == true) Machine_Idle_Breathing_Led(); } + if (m90msecTick) + { + for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++) + { + MillisecReadFromTempSensor(Sensor_i, NULL); + } + } if (Hundred_msTick) { Speed_Data = Calculate_Speed_Sensor_Velocity(); Read_Buttons_Reg(); for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++) { - MillisecReadFromTempSensor(Sensor_i, NULL); + MillisecUpdateTemperatures (Sensor_i,TemperatureSensorRead(Sensor_i)); } if (GeneralHwReady == true) { @@ -517,6 +556,10 @@ uint32_t MillisecLowLoop(uint32_t tick) Read_Heaters_Current(Heater_i); } Gas_PPM = Calculate_Gas_Power_Consumption(); + for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++) + { + TemperatureCalc[Sensor_i] = MillisecCalculateTemperatures ( Sensor_i); + } } if (OneMinute_Tick) { diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h index 064302685..be82d9e98 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.h @@ -33,6 +33,8 @@ float getSensorSpeedData(void); uint32_t getDrawerFansStatus(void); uint32_t getSystemFansStatus(void); uint8_t getGasReading(void); +int MillisecGetTemperatures (TEMPERATURE_SENSOR_ID_ENUM SensorId); + void MillisecInit(void); void MillisecStop(void); diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c index 425894857..c9bbe2df6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticActions.c @@ -120,16 +120,11 @@ uint32_t SetDigitalOutRequestRequestFunc(MessageContainer* requestContainer) Valve_Set(IDS_Id_to_CartrideValve[portId], request->value ); //Atm_MidTank_OFF/ON break; case INTERFACE_IOS__GPO_DRYER_SSR3_CTRL: -#ifdef DEMO_TEMPERATURE - HeaterTestActive[0] = false; -#endif + //CLEANER_PUMP_SSR3_CTRL if (request->value == true) - ActivateHeater(0); + ActivateCleanerPump(); else - DeActivateHeater(0); -#ifdef DEMO_TEMPERATURE - HeaterTestActive[0] = true; -#endif + DeActivateCleanerPump(); break; case INTERFACE_IOS__GPO_DRYER_SSR1_CTRL: #ifdef DEMO_TEMPERATURE diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index c936d842c..d39c97621 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -45,6 +45,10 @@ #include "StateMachines/Printing/PrintingSTM.h" +#include <drivers/FPGA/FPGA_Comm.h> + +extern F2_CTRL_REG F2_CTRL_Reg; + char DiagnosticsToken[36+1] = {0}; bool DiagnosticsActive = false; @@ -209,7 +213,10 @@ void DiagnosticLoadMotor(int MotorId, int frequency) void DiagnosticsLoadDigitalValues(void) { DigitalOutputState[0].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR3_CTRL; - DigitalOutputState[0].value = GetHeaterState(0); + if(F2_CTRL_Reg.ushort & CLEANER_PUMP_SSR3_CTRL) + DigitalOutputState[0].value = true; + else + DigitalOutputState[0].value = false; DigitalOutputState[1].interfaceio = INTERFACE_IOS__GPO_DRYER_SSR1_CTRL; DigitalOutputState[1].value = GetHeaterState(1); @@ -331,17 +338,17 @@ void Diagnostic100msecCollection(void) DiagnosticLoadMotor(WINDER_MOTOR, ThreadGetMotorSpeed (WINDER_MOTOR)); DiagnosticLoadMotor(SCREW_MOTOR, ThreadGetMotorSpeed (SCREW_MOTOR)); } - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__MixerHeater, TemperatureSensorRead( MIXER_PT100)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP1)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP2)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ3, TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP3)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4, TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP4)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ5, TemperatureSensorRead(TEMP_SENSE_ANALOG_DYEINGH_TEMP5)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ6, TemperatureSensorRead(HEAD6_PT100)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__MixerHeater, MillisecGetTemperatures( MIXER_PT100)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP1)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP2)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ3, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP3)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP4)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ5, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DYEINGH_TEMP5)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ6, MillisecGetTemperatures(HEAD6_PT100)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature, TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP1)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP2)); - DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, TemperatureSensorRead(TEMP_SENSE_ANALOG_DRYER_TEMP3)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP1)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP2)); + DiagnosticLoadTemperature(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, MillisecGetTemperatures(TEMP_SENSE_ANALOG_DRYER_TEMP3)); for (i=0;i<MAX_SYSTEM_DISPENSERS;i++) { dispensermotorfrequency[i][DiagnosticsIndex] = IdsGetMotorSpeed(i); diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 8fe9e5c2e..9f90289df 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -22,6 +22,7 @@ #include "../AlarmHandling/AlarmHandling.h" #include "../control/control.h" #include "../control/pidalgo.h" +#include "../control/MillisecTask.h" #include <ti/sysbios/knl/Task.h> #include <driverlib/timer.h> @@ -81,7 +82,7 @@ uint32_t OverHeatCounter [MAX_HEATERS_NUM] = {0,0,0,0,0,0,0,0,0,0}; uint32_t UnderHeatCounter [MAX_HEATERS_NUM] = {0,0,0,0,0,0,0,0,0,0}; uint32_t MainDryerHeaterMaxTempControl = 0xFF; uint32_t SecondDryerHeaterMaxTempControl = 0xFF; - +uint32_t DisasterControlId = 0xFF; #define DRYER_AIR_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP1 #define DRYER_MAIN_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP2 #define DRYER_SECONDARY_PT100 TEMP_SENSE_ANALOG_DRYER_TEMP3 @@ -122,11 +123,16 @@ EventType HeaterUnderEventType_B[MAX_HEATERS_NUM] = {EVENT_TYPE__DRYER_ZONE_1_UN EVENT_TYPE__DYEING_HEAD_ZONE_3_UNDERTEMPERATURE_B,EVENT_TYPE__DYEING_HEAD_ZONE_4_UNDERTEMPERATURE_B,EVENT_TYPE__DYEING_HEAD_ZONE_5_UNDERTEMPERATURE_B,EVENT_TYPE__DYEING_HEAD_ZONE_6_UNDERTEMPERATURE_B, EVENT_TYPE__MIXER_UNDERTEMPERATURE_B}; +int HeaterDisasterCounter[HARDWARE_PID_CONTROL_TYPE__MixerHeater+1] = {0,0,0,0,0,0,0,0,0,0}; +#define DISASTER_COUNTER_LIMIT 10 + /******************** FUNCTIONS ********************************************/ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue); uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue); uint32_t HeaterControlCBFunction(uint32_t deviceID, uint32_t readValue); uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue); +uint32_t HeatersDisasterControl(uint32_t x,uint32_t y); + uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue); void HeatersStartControlTimer (void); @@ -205,8 +211,8 @@ uint32_t LoadHeaterSetPoint(HeaterType HeaterType) void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) { int HeaterId = HeaterType; - double temp = TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); - //double temp = HeaterPreviousRead[HeaterId];//TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); + double temp = MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]); + //double temp = HeaterPreviousRead[HeaterId];//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]); HeaterState->has_heatertype = true; HeaterState->heatertype = HeaterType; @@ -214,7 +220,7 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) HeaterState->setpoint = HeaterCmd[HeaterId].targettemperatue/100; // HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse; HeaterState->has_currentvalue = true; - HeaterState->currentvalue = temp/100;//TemperatureSensorRead(HeaterId2PT100Id[HeaterId])/100; + HeaterState->currentvalue = temp/100;//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId])/100; HeaterState->has_isactive = true; HeaterState->isactive = GetHeaterState(HeaterId); HeaterState->has_isrampingup = true; @@ -399,7 +405,7 @@ uint32_t HeaterCommandRequestMessage(int HeaterId, bool OnOff, int Temperature) } else { - HeaterPreviousRead[HeaterId] = GetFilteredHeaterRead(HeaterId);// + HeaterPreviousRead[HeaterId] = MillisecGetTemperatures(HeaterId);// LOG_ERROR(HeaterId,"ReRead Heater Temp"); }*/ PrepareHeater(HeaterId,Temperature); //prepare the heaters control info @@ -430,12 +436,12 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) { if (ControlIdtoHeaterId [HeaterId] == 0xFF) { - ControlIdtoHeaterId [HeaterId] = AddControlCallback( HeaterControlCBFunction, Frequency/*eOneSecond*/,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),DryerInternalPT100Id,0); - //HeaterPreviousRead[HeaterId] = TemperatureSensorRead(DryerInternalPT100Id); - HeaterPreviousRead[HeaterId] = GetFilteredHeaterRead(HeaterId);// + ControlIdtoHeaterId [HeaterId] = AddControlCallback( HeaterControlCBFunction, Frequency/*eOneSecond*/,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),DryerInternalPT100Id,0); + //HeaterPreviousRead[HeaterId] = MillisecGetTemperatures(DryerInternalPT100Id); + HeaterPreviousRead[HeaterId] = MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]);// //Report("PrepareHeater AC Read", __FILE__,HeaterId, SetTemperatue, RpWarning,HeaterPreviousRead[HeaterId], 0); - HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = GetFilteredHeaterRead(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain);//TemperatureSensorRead(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]); - HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = GetFilteredHeaterRead(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary);// = TemperatureSensorRead(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]); + HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]);//MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]); + HeaterPreviousRead[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]);// = MillisecGetTemperatures(HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]); } //turn all alarms off AlarmHandlingSetAlarm(HeaterUnderEventType[HeaterId], false); @@ -443,7 +449,7 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) AlarmHandlingSetAlarm(HeaterEventType[HeaterId], false); if (ControlIdtoMaxHeaterId [HeaterId] == 0xFF) - ControlIdtoMaxHeaterId [HeaterId] = AddControlCallback( DcHeaterMaxTempCBFunction, eOneSecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); + ControlIdtoMaxHeaterId [HeaterId] = AddControlCallback( DcHeaterMaxTempCBFunction, eOneSecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); Enable_Reading_Heaters_Current(HeaterId2CurrentId[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain]); Enable_Reading_Heaters_Current(HeaterId2CurrentId[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary]); @@ -451,9 +457,9 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, 0); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0); if (MainDryerHeaterMaxTempControl == 0xFF) - MainDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain],0); + MainDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain],0); if (SecondDryerHeaterMaxTempControl == 0xFF) - SecondDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary],0); + SecondDryerHeaterMaxTempControl = AddControlCallback( HeaterMaxTempCBFunction, eHundredMillisecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary),HeaterId2PT100Id[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary],0); //InitialHeating = true; HeaterReady[HeaterId] = false; if (BlowerCfg.enabled == true) @@ -477,8 +483,11 @@ void PrepareACHeater(int HeaterId,uint32_t Frequency, uint32_t SetTemperatue) */ int PrepareDCHeater(int HeaterId, uint32_t Frequency, uint32_t SetTemperatue) { + if (DisasterControlId == 0xFF) + DisasterControlId = AddControlCallback( HeatersDisasterControl, eOneSecond,TemplateDataReadCBFunction,0,0, 0); + if (ControlIdtoHeaterId [HeaterId] == 0xFF) - ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, Frequency/*eOneSecond*/,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); + ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, Frequency/*eOneSecond*/,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); //HeaterPIDConfig[HeaterId].m_params.dt *=10; //DCInitialHeating[HeaterId] = true; HeaterReady[HeaterId] = false; @@ -491,7 +500,7 @@ int PrepareDCHeater(int HeaterId, uint32_t Frequency, uint32_t SetTemperatue) Enable_Reading_Heaters_Current(HeaterId2CurrentId[HeaterId]); - HeaterPreviousRead[HeaterId] = GetFilteredHeaterRead(HeaterId);//TemperatureSensorRead(HeaterId2PT100Id[HeaterId]); + HeaterPreviousRead[HeaterId] = MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]);//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]); if((abs(HeaterPreviousRead[HeaterId]-MINIMUM_HEATER_READ)<1)||(abs(MAXIMUM_HEATER_READ-HeaterPreviousRead[HeaterId])<10)) { LOG_ERROR (HeaterId,"PT100 not working properly"); @@ -499,7 +508,7 @@ int PrepareDCHeater(int HeaterId, uint32_t Frequency, uint32_t SetTemperatue) } //Report("PrepareHeater Read", __FILE__,HeaterId, SetTemperatue, RpWarning,HeaterPreviousRead[HeaterId], 0); if (ControlIdtoMaxHeaterId [HeaterId] == 0xFF) - ControlIdtoMaxHeaterId [HeaterId] = AddControlCallback( DcHeaterMaxTempCBFunction, eOneSecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); + ControlIdtoMaxHeaterId [HeaterId] = AddControlCallback( DcHeaterMaxTempCBFunction, eOneSecond,MillisecGetTemperatures,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0); return OK; } @@ -538,12 +547,17 @@ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue) HeaterPIDConfig[HeaterId].m_preError = 0; HeaterPIDConfig[HeaterId].m_SetParam = SetTemperatue*100;//need to update SetParams on presegment stage - temp = SetTemperatue*(100+HeaterControl[HeaterId].outputproportionalband); - temp = SetTemperatue*110.0; + int band = 5; + if (HeaterControl[HeaterId].outputproportionalband) + { + band = HeaterControl[HeaterId].outputproportionalband; + } + temp = SetTemperatue*(100+band); + //temp = SetTemperatue*110.0; HeaterControl[HeaterId].sensormaxvalue = (int)temp; - temp = SetTemperatue*(100-HeaterControl[HeaterId].outputproportionalband); - temp = SetTemperatue*90.0; + temp = SetTemperatue*(100-band); + //temp = SetTemperatue*90.0; HeaterControl[HeaterId].sensorminvalue = (int)temp; if (HeaterPIDConfig[HeaterId].m_params.IntegralErrorMultiplier) @@ -606,13 +620,11 @@ uint32_t MainPT100Read = 0,SecondaryPT100Read = 0; #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) #endif -uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) +uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) { int index=MAX_HEATERS_NUM; - int32_t MaxreadValue = max (MainPT100Read,SecondaryPT100Read); - int32_t MinreadValue = min (MainPT100Read,SecondaryPT100Read); - /*char str[100]; - uint8_t len = 0;*/ + int32_t MaxreadValue; + int32_t MinreadValue; if (IfIndex>>8 != IfTypeHeaters) { LOG_ERROR (IfIndex, "Wrong Interface type"); @@ -624,11 +636,15 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) LOG_ERROR (IfIndex, "Wrong Interface "); return 0xFFFFFFFF; } - int32_t readValue = TemperatureSensorRead(HeaterId2PT100Id[index]); + //int32_t readValue = MillisecGetTemperatures(HeaterId2PT100Id[index]); if (abs(readValue - HeaterPreviousRead[index])>2000) { Report("Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); return ERROR; } HeaterPreviousRead[index] = readValue; @@ -640,19 +656,24 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) { SecondaryPT100Read = readValue; } + MaxreadValue = max (MainPT100Read,SecondaryPT100Read); + MinreadValue = min (MainPT100Read,SecondaryPT100Read); + if ((MaxreadValue) >= HeaterControl[index].sensormaxvalue) { if (HeaterMaxTempFlag[index] == false) { - // LOG_ERROR (MaxreadValue/100, "Heater Over the max temperature, turned off"); + LOG_ERROR (MaxreadValue/100, "Heater Over the max temperature, turned off"); } DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = true; + //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true; + //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); return OK; } - if ((MinreadValue) <= (HeaterControl[index].sensormaxvalue-HeaterControl[index].sensorminvalue)) + if ((MaxreadValue) <= (HeaterControl[index].sensormaxvalue-HeaterControl[index].sensorminvalue)) //was MinreadValue { if (HeaterControl[index].sensorminvalue > 0) { @@ -663,7 +684,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) { ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); }*/ - // LOG_ERROR ((MinreadValue/100), "Heater Cooled Off max temperature, turned on"); + LOG_ERROR ((MinreadValue/100), "Heater Cooled Off max temperature, turned on"); } HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = false; HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = false; @@ -672,7 +693,7 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) } return ERROR; } -uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) +uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) { int index=MAX_HEATERS_NUM; if (IfIndex>>8 != IfTypeHeaters) @@ -681,7 +702,7 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) return 0xFFFFFFFF; } index = IfIndex&0xFF; - int32_t readValue = TemperatureSensorRead(HeaterId2PT100Id[index]); + //int32_t readValue = MillisecGetTemperatures(HeaterId2PT100Id[index]); if (HeaterControl[index].sensormaxvalue == 0) return OK; if ((HeaterPreviousRead[index]) >= HeaterControl[index].sensormaxvalue) @@ -689,6 +710,7 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) if(OverHeatCounter[index]++ >=Overheat_Count_Limit) { OverHeatCounter[index] = Overheat_Count_Limit; + //?????HeaterReady[index] = false; if (JobIsActive()&&(HeaterReady[index]==true)) { JobEndReason = JOB_TEMPERATURE_ALARM; @@ -711,6 +733,7 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) if(UnderHeatCounter[index]++ >=Underheat_Count_Limit) { UnderHeatCounter[index] = Underheat_Count_Limit; + //???HeaterReady[index] = false; if (JobIsActive()&&(HeaterReady[index]==true)) { JobEndReason = JOB_TEMPERATURE_ALARM; @@ -719,7 +742,7 @@ uint32_t DcHeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t eadValue) LOG_ERROR(index, "Temperature Error"); return OK; } - HeaterMinTempFlag[index] = true; + //HeaterMinTempFlag[index] = true; // Report("Heater under the min temperature",__FILE__,__LINE__,index,RpWarning,HeaterPreviousRead[index], HeaterControl[index].sensormaxvalue); if (HeaterReady[index]==false) AlarmHandlingSetAlarm(HeaterUnderEventType[index], true); @@ -763,17 +786,21 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) if (IfIndex>>8 != IfTypeHeaters) { LOG_ERROR (IfIndex, "Wrong Interface type"); - return 0xFFFFFFFF; + return ERROR; } index = IfIndex&0xFF; if (index != HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature) //AC Heaters { LOG_ERROR (IfIndex, "Wrong Interface "); - return 0xFFFFFFFF; + return ERROR; } if (HeaterCmd[index].targettemperatue == 0) { - DeActivateHeater(index); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + //Heaters OFF until coming into the proportional band + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); //LOG_ERROR (0, "unconfigured"); return ERROR; } @@ -782,12 +809,22 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) Report("AC Temperature Spike",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); if (readValue > HeaterCmd[index].targettemperatue) { - DeActivateHeater(index); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); } return ERROR; } + if (HeaterDisasterCounter[index] >= DISASTER_COUNTER_LIMIT) + { + Report("AC Temperature disaster",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); + return ERROR; + } HeaterPreviousRead[index] = readValue; // check if the read value is within the proportional band @@ -916,9 +953,15 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) DeActivateHeater(index); HeaterRecalculateHeaterParams(index, 0); } - return ERROR; } HeaterPreviousRead[index] = readValue; + if (HeaterDisasterCounter[index] >= DISASTER_COUNTER_LIMIT) + { + Report("DC Temperature disaster",__FILE__,index,HeaterPreviousRead[index],RpWarning,readValue, index); + DeActivateHeater (index); + return ERROR; + } + // check if the read value is within the proportional band if (HeaterReady[index]==false) { @@ -1031,55 +1074,102 @@ void EightMilliSecondHeatersInterrupt(UArg arg0) return ; } +int HeaterDisasterTemp[HARDWARE_PID_CONTROL_TYPE__MixerHeater+1] = {28000,28000,28000,17000,17000,17000,17000,17000,17000,11000}; +//int HeaterDisasterTemp[HARDWARE_PID_CONTROL_TYPE__MixerHeater+1] = {8100,8100,8200,8100,8100,8100,8100,8100,8100,8100}; +uint32_t HeatersDisasterControl(uint32_t x,uint32_t y) +{ + int HeaterId,temperature; + for ( HeaterId = HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature; HeaterId<= HARDWARE_PID_CONTROL_TYPE__MixerHeater;HeaterId++) + { + temperature = MillisecGetTemperatures(HeaterId2PT100Id[HeaterId]); + if (temperature>=HeaterDisasterTemp[HeaterId]) + { + Report("Disaster Temperature ",__FILE__,HeaterId,temperature,RpWarning,HeaterDisasterTemp[HeaterId], 0); + if (HeaterDisasterCounter[HeaterId]++ >= DISASTER_COUNTER_LIMIT) + HeaterDisasterCounter[HeaterId] = DISASTER_COUNTER_LIMIT; + } + else if (temperature<0) + { + if (HeaterDisasterCounter[HeaterId]++ <= 0) + HeaterDisasterCounter[HeaterId] = 0; + } + else + { + if (HeaterDisasterCounter[HeaterId]-- <= 0) + HeaterDisasterCounter[HeaterId] = 0; + } + + } + return OK; +} uint32_t HeatersControlLoop(uint32_t tick) { //char str[100]; //uint8_t len = 0; int DcHeaterId; + bool AcHeaterDisaster = false; + /*len = usnprintf(str, 100, "\r\n EightMilliSecondHeatersInterrupt SliceCounter %d Owner %d H1000 %d H2000 %d" ,SliceCounter,TimeSliceAllocation[SliceCounter],HeatersRestart,NumberOFSlicesInUse); Report(str, __FILE__,__LINE__,0, RpMessage, SliceCounter, TimeSliceAllocation[SliceCounter]); */ - static bool first = true; - if (first == true) + if (HeaterDisasterCounter[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] >= DISASTER_COUNTER_LIMIT) + { + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + AcHeaterDisaster = true; + } + if (HeaterDisasterCounter[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] >= DISASTER_COUNTER_LIMIT) { - first = false; + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + AcHeaterDisaster = true; } - if (HeaterReady[HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature] == true) + + + if (AcHeaterDisaster == false) { - if (TimeSliceAllocation[SliceCounter] == HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain) + if (HeaterReady[HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature] == true) { - if (HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] == false) + if (TimeSliceAllocation[SliceCounter] == HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain) { - //If HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain should be active - //Activate HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain - ActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); - //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary - DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + if (HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] == false) + { + //If HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain should be active + //Activate HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain + ActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + } } - } - else if (TimeSliceAllocation[SliceCounter] == HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary) - { - if (HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] == false) + else if (TimeSliceAllocation[SliceCounter] == HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary) { - //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain - DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); - //If HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary should be active - //Activate HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary - ActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + if (HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] == false) + { + //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + //If HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary should be active + //Activate HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary + ActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); + } + } + else + { + //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); + //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary + DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); } - } - else - { - //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain - DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); - //DeActivate HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary - DeActivateHeater (HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); } } for ( DcHeaterId = HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1; DcHeaterId<= HARDWARE_PID_CONTROL_TYPE__MixerHeater;DcHeaterId++) { + if (HeaterDisasterCounter[DcHeaterId] >= DISASTER_COUNTER_LIMIT) + { + DeActivateHeater (DcHeaterId); + continue; + } if (HeaterReady[DcHeaterId] == false) continue; if (DCTimeSliceAllocation[DcHeaterId] > 0) //heater active diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h index 80a55d63e..3d2bcf9ff 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h @@ -5,7 +5,7 @@ #include "drivers/motors/motor.h" #include "ids_ex.h" -extern uint32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS]; +extern int32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS]; extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS]; extern float DispenserPressure[MAX_SYSTEM_DISPENSERS]; uint32_t DispenserConfigMessage(HardwareDispenser * request); diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c index b33b531a3..868ddca9c 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_dispenser.c @@ -33,7 +33,8 @@ double DispenserPreparePressure = DISPENSER_BUILD_PRESSURE_LIMIT; uint32_t DispenserPrepareTimeout = DISPENSER_BUILD_PRESSURE_TIMEOUT; uint32_t DispenserPrepareTimeLag = DISPENSER_BUILD_PRESSURE_LAG; uint32_t DispenserPrepareTime[MAX_SYSTEM_DISPENSERS] = {0,0,0,0,0,0,0,0}; -uint32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS] = {0, 0, 0, 0, 0, 0, 0, 0,}; + +int32_t CurrentDispenserSpeed[MAX_SYSTEM_DISPENSERS] = {0, 0, 0, 0, 0, 0, 0, 0,}; callback_fptr DispenserCallback[MAX_SYSTEM_DISPENSERS] = {0, 0, 0, 0, 0, 0, 0, 0,}; uint32_t DispenserControlId[MAX_SYSTEM_DISPENSERS] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; @@ -55,7 +56,7 @@ void IDS_Dispenser_SetTimeOutValues(uint32_t CloseTimeout, uint32_t OpenTimeout) } //******************************************************************************************************************** -uint32_t IdsGetMotorSpeed(uint32_t DispenserId) +int32_t IdsGetMotorSpeed(uint32_t DispenserId) { return CurrentDispenserSpeed[DispenserId]; } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h index 9b2442698..350e553b6 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h @@ -75,6 +75,6 @@ uint32_t IDS_MapDispenserUsedinFileJob(void *JobDetails); float CalculateDispenserPressure (int DispenserId); float GetDispenserPressure(int DispenserId); -uint32_t IdsGetMotorSpeed(uint32_t DispenserId); +int32_t IdsGetMotorSpeed(uint32_t DispenserId); #endif /* MODULES_IDS_IDS_EX_H_ */ diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index 1bdf15b29..215fab544 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -78,13 +78,14 @@ void IDS_Dispenser_SetBackLashValues(double initialdispenserpressure, uint32 Report("IDS_Dispenser_SetBackLashValues ",__FILE__,InitialDispenserPressure,InitialDispenserTimeout,RpWarning,(int)InitialDispenserTimeLag,0); } -uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t deviceID, uint32_t ReadValue) +uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t motorId, uint32_t ReadValue) { - uint8_t DispenserId = deviceID-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; + uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; if ((GetDispenserPressure(DispenserId)>=InitialDispenserPressure)||(DispenserHomingTime[DispenserId]>InitialDispenserTimeout)) { - MotorStop(deviceID,Hard_Hiz); - MotorSetMicroStep(deviceID, MotorsCfg[deviceID].microstep); + MotorStop(motorId,Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; + MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); HomingActive[DispenserId]= false; Report("End backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); if (SafeRemoveControlCallback(DispenserHomingControlId[DispenserId], IDS_HomeDispenserBackMoveCallback )==OK) @@ -99,15 +100,15 @@ uint32_t IDS_HomeDispenserBackMoveCallback(uint32_t deviceID, uint32_t ReadValue } return OK; } -uint32_t IDS_HomeDispenserCallback(uint32_t deviceID, uint32_t ReadValue) +uint32_t IDS_HomeDispenserCallback(uint32_t motorId, uint32_t ReadValue) { - uint8_t DispenserId = deviceID-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; + uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; Read_MidTank_Pressure_Sensor(DispenserId); //close dry air valve in the dispenser Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Disable_MidTank_Pressure_Reading(DispenserId); - //MotorSetMicroStep(deviceID, MotorsCfg[deviceID].microstep); + //MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); if (HomingRequestCallback[DispenserId]) { HomingRequestCallback[DispenserId](DispenserId,0); @@ -115,11 +116,12 @@ uint32_t IDS_HomeDispenserCallback(uint32_t deviceID, uint32_t ReadValue) } // HomingActive[DispenserId]= false; Report("Start backlash",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); - DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,deviceID, deviceID, 0 ); + DispenserHomingControlId[DispenserId] = AddControlCallback( IDS_HomeDispenserBackMoveCallback, InitialDispenserTimeLag, GetDispenserPressure,motorId, motorId, 0 ); - MotorSetDirection(deviceID,MotorsCfg[deviceID].directionthreadwize); + MotorSetDirection(motorId,MotorsCfg[motorId].directionthreadwize); - MotorSetSpeed(deviceID, 1000); + MotorSetSpeed(motorId, 1000); + CurrentDispenserSpeed[DispenserId] = 1000; IDS_Dispenser_RefillEnded ( DispenserId); @@ -127,74 +129,84 @@ return OK; } -uint32_t IDS_HomeDispenser (uint32_t deviceID, uint32_t speed , callback_fptr callback) +uint32_t IDS_HomeDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr callback) { - assert(deviceID < MAX_SYSTEM_DISPENSERS); + assert(DispenserId < MAX_SYSTEM_DISPENSERS); - //if (DispensersAlarmState[deviceID] == true) + //if (DispensersAlarmState[DispenserId] == true) // return ERROR; - if (HomingActive[deviceID] == true) + if (HomingActive[DispenserId] == true) + { + LOG_ERROR (DispenserId,"Homing already active"); return ERROR; + } else - HomingActive[deviceID] = true; + HomingActive[DispenserId] = true; - HomingRequestCallback[deviceID] = callback; + HomingRequestCallback[DispenserId] = callback; - TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + deviceID; - if ( Dispenser_Id_to_LS_Id[deviceID] != MAX_GPI) + TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; + if ( Dispenser_Id_to_LS_Id[DispenserId] != MAX_GPI) { //open dispenser valve dispenser to midtank direction - Control3WayValvesWithCallback ((Valves_t)deviceID, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer //Valve_Set((Valves_t) request->index, MidTank_Dispenser); MotorSetMicroStep(MotorId, 1); SysCtlDelay(180000); //open dry air valve in the dispenser - Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_ON); + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_ON); - IDS_Dispenser_RefillStarted(deviceID); - MotorMovetoLimitSwitch (MotorId,1-MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Id[deviceID], IDS_HomeDispenserCallback,0); + IDS_Dispenser_RefillStarted(DispenserId); + MotorMovetoLimitSwitch (MotorId,1-MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Id[DispenserId], IDS_HomeDispenserCallback,0); + CurrentDispenserSpeed[DispenserId] = (-1*speed); return OK; } return ERROR; } -uint32_t IDS_Dispenser_Alarm_On (uint8_t deviceID) +uint32_t IDS_Dispenser_Alarm_On (uint8_t DispenserId) { uint32_t status = OK; - DispensersAlarmState[deviceID] = true; - TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + deviceID; + DispensersAlarmState[DispenserId] = true; + TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; status |= MotorAbortMovetoLimitSwitch(MotorId); - Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_OFF); - Enable_MidTank_Pressure_Reading(deviceID); - status |= MotorSetMicroStep(deviceID, MotorsCfg[deviceID].microstep); - status |= MotorStop(deviceID, Hard_Hiz); + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Enable_MidTank_Pressure_Reading(DispenserId); + status |= MotorSetMicroStep(DispenserId, MotorsCfg[DispenserId].microstep); + status |= MotorStop(DispenserId, Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; JobEndReason = JOB_OUT_OF_DYE; return status; } -uint32_t IDS_Dispenser_Alarm_Off (uint8_t deviceID) +uint32_t IDS_Dispenser_Alarm_Off (uint8_t DispenserId) { uint32_t status = OK; - DispensersAlarmState[deviceID] = false; + DispensersAlarmState[DispenserId] = false; return status; } -uint32_t IDS_StopHomeDispenser (uint32_t deviceID) +uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) { - assert(deviceID < MAX_SYSTEM_DISPENSERS); + assert(DispenserId < MAX_SYSTEM_DISPENSERS); - if (HomingActive[deviceID] != true) + Report("IDS_StopHomeDispenser",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)HomingActive[DispenserId],0); + if (HomingActive[DispenserId] != true) + { + LOG_ERROR (DispenserId,"Homing not active"); return ERROR; + } else - HomingActive[deviceID] = false; + HomingActive[DispenserId] = false; - TimerMotors_t MotorId = (deviceID)+HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; + TimerMotors_t MotorId = (DispenserId)+HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; MotorAbortMovetoLimitSwitch(MotorId); //close dry air valve in the dispenser - Disable_MidTank_Pressure_Reading(deviceID); - Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_OFF); - Control3WayValvesWithCallback ((Valves_t)deviceID, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + Disable_MidTank_Pressure_Reading(DispenserId); + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer MotorSetMicroStep(MotorId, MotorsCfg[MotorId].microstep); + CurrentDispenserSpeed[DispenserId] = 0; return OK; } @@ -215,34 +227,35 @@ uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id) return FPGA_Read_limit_Switches(Dispenser_Id_to_Alarm_LS_Id[LS_Id]); } -uint32_t IDS_EmptyDispenser (uint32_t deviceID, uint32_t speed , callback_fptr callback) +uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr callback) { - assert(deviceID < MAX_SYSTEM_DISPENSERS); + assert(DispenserId < MAX_SYSTEM_DISPENSERS); - //if (DispensersAlarmState[deviceID] == true) + //if (DispensersAlarmState[DispenserId] == true) // return ERROR; - if (HomingActive[deviceID] == true) + if (HomingActive[DispenserId] == true) return ERROR; else - HomingActive[deviceID] = true; - HomingRequestCallback[deviceID] = callback; + HomingActive[DispenserId] = true; + HomingRequestCallback[DispenserId] = callback; - TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + deviceID; - if ( Dispenser_Id_to_LS_Empty_Id[deviceID] != MAX_GPI) + TimerMotors_t MotorId = HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1 + DispenserId; + if ( Dispenser_Id_to_LS_Empty_Id[DispenserId] != MAX_GPI) { //open dispenser valve dispenser to midtank direction - Control3WayValvesWithCallback ((Valves_t)deviceID, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + Control3WayValvesWithCallback ((Valves_t)DispenserId, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer //Valve_Set((Valves_t) request->index, Dispenser_Mixer); MotorSetMicroStep(MotorId, 1); SysCtlDelay(180000); //open dry air valve in the dispenser - //Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_ON); - IDS_Dispenser_RefillStarted(deviceID); - IDS_Dispenser_MovingDirection(deviceID,UP); + //Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_ON); + IDS_Dispenser_RefillStarted(DispenserId); + IDS_Dispenser_MovingDirection(DispenserId,UP); - MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[deviceID], IDS_HomeDispenserCallback,0); + MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_HomeDispenserCallback,0); + CurrentDispenserSpeed[DispenserId] = speed; return OK; } return ERROR; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 2a8cac415..901019e22 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -502,7 +502,7 @@ c. Go to step 2.a x Segment.BrushStopsCount. { if (DispenserUsedInJob[i] == true) //we actually should check for all dispensers { - IDS_StopHomeDispenser(i); + //IDS_StopHomeDispenser(i); DispenserReady[i] = false; IDS_Dispenser_Build_Pressure(i, IDS_PrepareReady); REPORT_MSG(i,"Dispenser prepare called"); @@ -510,7 +510,7 @@ c. Go to step 2.a x Segment.BrushStopsCount. else { DispenserReady[i] = true; - IDS_HomeDispenser (i, 1000 , NULL); + //IDS_HomeDispenser (i, 1000 , NULL); } } @@ -781,10 +781,13 @@ uint32_t IDSPreSegmentState(void *SegmentDetails, int SegmentId) { MotorSetMicroStep(HW_Motor_Id, MotorsCfg[HW_Motor_Id].microstep); } - MotorStop(HW_Motor_Id,Hard_Hiz); //26/03/19 test without valves - CurrentDispenserSpeed[DispenserId] = 0; + if ((EnableIntersegment == true)&&(IntersegmentLength>0)) + { + MotorStop(HW_Motor_Id,Hard_Hiz); //26/03/19 test without valves + CurrentDispenserSpeed[DispenserId] = 0; + REPORT_MSG(DispenserId,"Dispenser stopped pre Segment"); + } IDS_Valve_PresegmentReady(DispenserId,0); //27/03/19 to be removed when the presegment handler will be added - //REPORT_MSG(DispenserId,"Dispenser stopped pre Segment"); } } @@ -1012,7 +1015,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) //TimerMotors_t HW_Motor_Id = DispenserIdToMotorId[deviceID]; //REPORT_MSG(deviceID,"Dispenser End called"); //MotorStop(HW_Motor_Id,Hard_Hiz); - IDS_HomeDispenser (deviceID, 1000 , NULL); + //IDS_HomeDispenser (deviceID, 800 , NULL); return OK; } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c index 7d42ad8f5..2db4474f7 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Initialization/PowerIdle.c @@ -36,17 +36,17 @@ void PowerIdleSetIdle(void) { memcpy (&ActiveProcessParameters,&ProcessParametersKeep,sizeof(ProcessParameters)); ProcessParameters ProcessParametersClear; - ProcessParametersClear.dryerzone1temp = 80; - ProcessParametersClear.dryerzone2temp = 80; - ProcessParametersClear.dryerzone3temp = 80; - ProcessParametersClear.mixertemp = 0; - ProcessParametersClear.headzone1temp = 80; - ProcessParametersClear.headzone2temp = 80; - ProcessParametersClear.headzone3temp = 80; - ProcessParametersClear.headzone4temp = 80; - ProcessParametersClear.headzone5temp = 80; - ProcessParametersClear.headzone6temp = 80; - ProcessParametersClear.dyeingspeed = 40; + ProcessParametersClear.dryerzone1temp = (ActiveProcessParameters.dryerzone1temp<80)? ActiveProcessParameters.dryerzone1temp:80; + ProcessParametersClear.dryerzone2temp = (ActiveProcessParameters.dryerzone2temp<80)? ActiveProcessParameters.dryerzone2temp:80; + ProcessParametersClear.dryerzone3temp = (ActiveProcessParameters.dryerzone3temp<80)? ActiveProcessParameters.dryerzone3temp:80; + ProcessParametersClear.mixertemp = (ActiveProcessParameters.mixertemp <80)? ActiveProcessParameters.mixertemp :80; + ProcessParametersClear.headzone1temp = (ActiveProcessParameters.headzone1temp <80)? ActiveProcessParameters.headzone1temp :80; + ProcessParametersClear.headzone2temp = (ActiveProcessParameters.headzone2temp <80)? ActiveProcessParameters.headzone2temp :80; + ProcessParametersClear.headzone3temp = (ActiveProcessParameters.headzone3temp <80)? ActiveProcessParameters.headzone3temp :80; + ProcessParametersClear.headzone4temp = (ActiveProcessParameters.headzone4temp <80)? ActiveProcessParameters.headzone4temp :80; + ProcessParametersClear.headzone5temp = (ActiveProcessParameters.headzone5temp <80)? ActiveProcessParameters.headzone5temp :80; + ProcessParametersClear.headzone6temp = (ActiveProcessParameters.headzone6temp <80)? ActiveProcessParameters.headzone6temp :80; + ProcessParametersClear.dyeingspeed = (ActiveProcessParameters.dyeingspeed <40)? ActiveProcessParameters.dyeingspeed :40; if (HandleProcessParameters(&ProcessParametersClear)!= OK) { LOG_ERROR (1, "Turn Heaters idle failed"); diff --git a/Software/External_Repositories/OpenCV/bin/opencv_aruco330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_aruco330d.exp Binary files differnew file mode 100644 index 000000000..b863e4d98 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_aruco330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_aruco330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_aruco330d.lib Binary files differnew file mode 100644 index 000000000..cd11751a0 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_aruco330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_calib3d330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_calib3d330d.exp Binary files differnew file mode 100644 index 000000000..919eb06d7 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_calib3d330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_calib3d330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_calib3d330d.lib Binary files differnew file mode 100644 index 000000000..e20981fe4 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_calib3d330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_core330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_core330d.exp Binary files differnew file mode 100644 index 000000000..07e5d841b --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_core330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_core330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_core330d.lib Binary files differnew file mode 100644 index 000000000..e290becdb --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_core330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_dnn330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_dnn330d.exp Binary files differnew file mode 100644 index 000000000..e5019b273 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_dnn330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_dnn330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_dnn330d.lib Binary files differnew file mode 100644 index 000000000..ac223e278 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_dnn330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_features2d330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_features2d330d.exp Binary files differnew file mode 100644 index 000000000..b7d300f68 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_features2d330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_features2d330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_features2d330d.lib Binary files differnew file mode 100644 index 000000000..24e758a2a --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_features2d330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_flann330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_flann330d.exp Binary files differnew file mode 100644 index 000000000..fcbd58789 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_flann330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_flann330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_flann330d.lib Binary files differnew file mode 100644 index 000000000..e9289d225 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_flann330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_highgui330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_highgui330d.exp Binary files differnew file mode 100644 index 000000000..82868b740 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_highgui330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_highgui330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_highgui330d.lib Binary files differnew file mode 100644 index 000000000..40fdbacf9 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_highgui330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_imgcodecs330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_imgcodecs330d.exp Binary files differnew file mode 100644 index 000000000..20e453c63 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_imgcodecs330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_imgcodecs330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_imgcodecs330d.lib Binary files differnew file mode 100644 index 000000000..7a3697a81 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_imgcodecs330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_imgproc330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_imgproc330d.exp Binary files differnew file mode 100644 index 000000000..96a3b049b --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_imgproc330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_imgproc330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_imgproc330d.lib Binary files differnew file mode 100644 index 000000000..6d1b134de --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_imgproc330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_ml330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_ml330d.exp Binary files differnew file mode 100644 index 000000000..498de9fea --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_ml330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_ml330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_ml330d.lib Binary files differnew file mode 100644 index 000000000..5f55bd260 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_ml330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_objdetect330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_objdetect330d.exp Binary files differnew file mode 100644 index 000000000..4c6535c66 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_objdetect330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_objdetect330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_objdetect330d.lib Binary files differnew file mode 100644 index 000000000..9b72118bb --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_objdetect330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_photo330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_photo330d.exp Binary files differnew file mode 100644 index 000000000..955275f86 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_photo330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_photo330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_photo330d.lib Binary files differnew file mode 100644 index 000000000..9c6857b34 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_photo330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_shape330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_shape330d.exp Binary files differnew file mode 100644 index 000000000..c1ddd742b --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_shape330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_shape330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_shape330d.lib Binary files differnew file mode 100644 index 000000000..e7e4bcc71 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_shape330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_stitching330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_stitching330d.exp Binary files differnew file mode 100644 index 000000000..8c5266fbc --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_stitching330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_stitching330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_stitching330d.lib Binary files differnew file mode 100644 index 000000000..cccd130a7 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_stitching330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_superres330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_superres330d.exp Binary files differnew file mode 100644 index 000000000..3c29e616b --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_superres330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_superres330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_superres330d.lib Binary files differnew file mode 100644 index 000000000..f9ee92190 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_superres330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_ts330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_ts330d.lib Binary files differnew file mode 100644 index 000000000..a11b1f3ed --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_ts330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_video330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_video330d.exp Binary files differnew file mode 100644 index 000000000..980f49d6b --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_video330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_video330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_video330d.lib Binary files differnew file mode 100644 index 000000000..6d5a3c5b3 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_video330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_videoio330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_videoio330d.exp Binary files differnew file mode 100644 index 000000000..db7a33940 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_videoio330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_videoio330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_videoio330d.lib Binary files differnew file mode 100644 index 000000000..1a343fba1 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_videoio330d.lib diff --git a/Software/External_Repositories/OpenCV/bin/opencv_videostab330d.exp b/Software/External_Repositories/OpenCV/bin/opencv_videostab330d.exp Binary files differnew file mode 100644 index 000000000..25687763d --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_videostab330d.exp diff --git a/Software/External_Repositories/OpenCV/bin/opencv_videostab330d.lib b/Software/External_Repositories/OpenCV/bin/opencv_videostab330d.lib Binary files differnew file mode 100644 index 000000000..c2cab1b20 --- /dev/null +++ b/Software/External_Repositories/OpenCV/bin/opencv_videostab330d.lib diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/darkening.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/darkening.png Binary files differnew file mode 100644 index 000000000..a18946b8e --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/darkening.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/logo.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/logo.png Binary files differnew file mode 100644 index 000000000..d603442d6 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/logo.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/more_normal.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..8f8c4e153 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/more_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/more_selected.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..28b678a74 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/more_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/my_colors.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..64433b097 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/my_colors.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/selected.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/selected.png Binary files differnew file mode 100644 index 000000000..59b34c80f --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/twine_card.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..33849c970 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/twine_card.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/twinesnap_normal.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..79705e9ca --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/twinesnap_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-hdpi/twinesnap_selected.png b/Software/Graphics/Mobile/zeplin/drawable-hdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..3ca5bf9b7 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-hdpi/twinesnap_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/darkening.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/darkening.png Binary files differnew file mode 100644 index 000000000..58cf40d6a --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/darkening.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/logo.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/logo.png Binary files differnew file mode 100644 index 000000000..d9dc2cf15 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/logo.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/more_normal.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..6c8ce0b9a --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/more_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/more_selected.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..179384dd0 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/more_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/my_colors.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..c38fbefc1 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/my_colors.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/selected.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/selected.png Binary files differnew file mode 100644 index 000000000..0a5041bb9 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/twine_card.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..1b77e264e --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/twine_card.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/twinesnap_normal.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..3999dfb84 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/twinesnap_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-mdpi/twinesnap_selected.png b/Software/Graphics/Mobile/zeplin/drawable-mdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..6bd9f3638 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-mdpi/twinesnap_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/darkening.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/darkening.png Binary files differnew file mode 100644 index 000000000..f50441f22 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/darkening.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/logo.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/logo.png Binary files differnew file mode 100644 index 000000000..f6b3bf9be --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/logo.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/more_normal.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..a540c41be --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/more_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/more_selected.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..60494cce8 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/more_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/my_colors.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..2eae175fd --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/my_colors.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/selected.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/selected.png Binary files differnew file mode 100644 index 000000000..e1aa19889 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twine_card.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..4eb5dc787 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twine_card.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twinesnap_normal.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..bf6509ea2 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twinesnap_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twinesnap_selected.png b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..f71ff6ea5 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xhdpi/twinesnap_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/darkening.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/darkening.png Binary files differnew file mode 100644 index 000000000..ff47c2bd1 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/darkening.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/logo.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/logo.png Binary files differnew file mode 100644 index 000000000..fe384b6dd --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/logo.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/more_normal.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..edbed5b5e --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/more_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/more_selected.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..263622f94 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/more_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/my_colors.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..1570ddb97 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/my_colors.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/selected.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/selected.png Binary files differnew file mode 100644 index 000000000..6c4d944f2 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twine_card.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..d095059bb --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twine_card.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twinesnap_normal.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..6b098152f --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twinesnap_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twinesnap_selected.png b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..94e490595 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxhdpi/twinesnap_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/darkening.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/darkening.png Binary files differnew file mode 100644 index 000000000..d55bc070d --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/darkening.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/logo.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/logo.png Binary files differnew file mode 100644 index 000000000..b173a3c86 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/logo.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/more_normal.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/more_normal.png Binary files differnew file mode 100644 index 000000000..1f009161c --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/more_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/more_selected.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/more_selected.png Binary files differnew file mode 100644 index 000000000..80b2611cf --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/more_selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/my_colors.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/my_colors.png Binary files differnew file mode 100644 index 000000000..b816454ed --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/my_colors.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/selected.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/selected.png Binary files differnew file mode 100644 index 000000000..705b88dfe --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/selected.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twine_card.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twine_card.png Binary files differnew file mode 100644 index 000000000..857f83930 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twine_card.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twinesnap_normal.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twinesnap_normal.png Binary files differnew file mode 100644 index 000000000..f48411cb9 --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twinesnap_normal.png diff --git a/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twinesnap_selected.png b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twinesnap_selected.png Binary files differnew file mode 100644 index 000000000..3741bdb4a --- /dev/null +++ b/Software/Graphics/Mobile/zeplin/drawable-xxxhdpi/twinesnap_selected.png diff --git a/Software/Stubs Collection/stubs/embeddedparametersbuild.cs b/Software/Stubs Collection/stubs/embeddedparametersbuild.cs index f23dd380f..3ad7c1da8 100644 --- a/Software/Stubs Collection/stubs/embeddedparametersbuild.cs +++ b/Software/Stubs Collection/stubs/embeddedparametersbuild.cs @@ -33,8 +33,8 @@ configurationParameters.CloseValveTimeout = 252; configurationParameters.OpenValveTimeout = 252; //backlash after filling - -configurationParameters.InitialDispenserPressure = 0.5; -configurationParameters.InitialDispenserTimeout = 20000; //20 seconds +configurationParameters.InitialDispenserPressure = 1.5; +configurationParameters.InitialDispenserTimeout = 60000; //20 seconds configurationParameters.InitialDispenserTimeLag = 100; //job prepare - build pressure in dispensers @@ -50,24 +50,24 @@ configurationParameters.ACHeatersUpperOperationLimit = 1005; configurationParameters.DCHeatersLowerOperationLimit = 978; configurationParameters.DCHeatersUpperOperationLimit = 1005; -configurationParameters.MidTankPressureCorrection = 0.5; +configurationParameters.MidTankPressureCorrection = 0.2; -File.WriteAllBytes("C:/temp/EmbParam.msg",configurationParameters.ToBytes()); +File.WriteAllBytes("C:/temp/EmbParam.cfg",configurationParameters.ToBytes()); -byte[] fileBytes = File.ReadAllBytes("C:/temp/EmbParam.msg"); +byte[] fileBytes = File.ReadAllBytes("C:/temp/EmbParam.cfg"); DeleteRequest deleteRequest = new DeleteRequest(); -deleteRequest.Path = "0://SysInfo//EmbParam.msg"; +deleteRequest.Path = "0://SysInfo//EmbParam.cfg"; var response5 = stubManager.Run<DeleteResponse>(deleteRequest); FileUploadRequest fileUploadRequest = new FileUploadRequest(); -fileUploadRequest.Path = "0://SysInfo//EmbParam.msg"; +fileUploadRequest.Path = "0://SysInfo//EmbParam.cfg"; fileUploadRequest.Length = (int)fileBytes.Length; FileUploadResponse response2 = stubManager.Run<FileUploadResponse>(fileUploadRequest); long chunk_size = response2.MaxChunkLength; -FileStream fs = new FileStream("C:/temp/EmbParam.msg",FileMode.Open); +FileStream fs = new FileStream("C:/temp/EmbParam.cfg",FileMode.Open); while (fs.Position < fs.Length) { diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk Binary files differindex ff9db3779..34c82a731 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs index 9f54837cb..0b74f2b3f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs @@ -103,6 +103,13 @@ namespace Tango.MachineStudio.ColorCapture.Models set { _enableDoubleChecking = value; RaisePropertyChangedAuto(); } } + private bool _enforceBarcodeDetection; + public bool EnforceBarcodeDetection + { + get { return _enforceBarcodeDetection; } + set { _enforceBarcodeDetection = value; RaisePropertyChangedAuto(); } + } + public CaptureConfig() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs index 21bb0baf0..5ea5747d5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs @@ -140,6 +140,14 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels set { _similarity = value; RaisePropertyChangedAuto(); } } + private String _barcode; + public String Barcode + { + get { return _barcode; } + set { _barcode = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand ImportBenchmarksCommand { get; set; } public RelayCommand ExportBenchmarksCommand { get; set; } @@ -373,6 +381,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels DetectedSource = null; CaptureDeltaEController.Clear(); Similarity = 0; + Barcode = String.Empty; } private void OnSelectedVideoDeviceChanged(CaptureDevice previousDevice, CaptureDevice newDevice) @@ -407,6 +416,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels SimilarityTolerance = Config.SimilarityTolerance, HistogramMethod = Config.HistogramComparison, EnableDoubleChecking = Config.EnableDoubleChecking, + EnforceBarcodeDetection = Config.EnforceBarcodeDetection, }); if (result.Similarity > 0) @@ -442,6 +452,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels CapturedColor = Color.FromArgb(255, (byte)result.ColorDetectionOutput.RawColor.R, (byte)result.ColorDetectionOutput.RawColor.G, (byte)result.ColorDetectionOutput.RawColor.B); ProcessedColor = Color.FromArgb(255, (byte)result.ColorDetectionOutput.ProcessedColor.R, (byte)result.ColorDetectionOutput.ProcessedColor.G, (byte)result.ColorDetectionOutput.ProcessedColor.B); + Barcode = result.Barcode; + //calculate delta E. Lab measureLab = new Lab(MeasureL, MeasureA, MeasureB); DeltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), GetDeltaEComparison()); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml index d6f4890d7..ba8e3f281 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml @@ -276,6 +276,11 @@ </Border> </DockPanel> </DockPanel> + + <TextBlock Margin="0 0 0 -20" VerticalAlignment="Bottom"> + <Run>Barcode:</Run> + <Run Text="{Binding Barcode}" FontWeight="SemiBold" FontStyle="Italic"></Run> + </TextBlock> </Grid> <DockPanel VerticalAlignment="Bottom" Grid.ColumnSpan="2" TextElement.FontSize="16"> @@ -582,6 +587,7 @@ <RowDefinition Height="40"/> <RowDefinition Height="40"/> <RowDefinition Height="40"/> + <RowDefinition Height="40"/> </Grid.RowDefinitions> <TextBlock VerticalAlignment="Bottom" Height="27">Columns</TextBlock> @@ -637,6 +643,9 @@ <TextBlock Grid.Row="12" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Double Checking</TextBlock> <ToggleButton IsChecked="{Binding Config.EnableDoubleChecking}" Grid.Row="12" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> + + <TextBlock Grid.Row="13" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Enforce Barcode Detection</TextBlock> + <ToggleButton IsChecked="{Binding Config.EnforceBarcodeDetection}" Grid.Row="13" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> </Grid> </Border> </TabItem> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs index e63e0bdd1..b2b2bc197 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs @@ -19,6 +19,7 @@ namespace Tango.TCC.BL public double SimilarityTolerance { get; set; } public CardDetectionHistogramMethods HistogramMethod { get; set; } public bool EnableDoubleChecking { get; set; } + public bool EnforceBarcodeDetection { get; set; } public CardDetectionConfig() { diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs index 50bcceeba..221659868 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs @@ -66,6 +66,7 @@ namespace Tango.TCC.BL SimilarityTolerance = config.SimilarityTolerance, HistogramMethod = (int)config.HistogramMethod, EnableDoubleChecking = config.EnableDoubleChecking, + EnforceBarcodeDetection = config.EnforceBarcodeDetection, }); detectionResult.Similarity = result.Similarity; diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs index d6161e738..5ab6cfd6d 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs @@ -17,6 +17,7 @@ namespace Tango.TCC.BL.Web public double SimilarityTolerance { get; set; } public CardDetectionHistogramMethods HistogramMethod { get; set; } public bool EnableDoubleChecking { get; set; } + public bool EnforceBarcodeDetection { get; set; } public DefinitionResponse() { @@ -27,6 +28,7 @@ namespace Tango.TCC.BL.Web SimilarityTolerance = 50; HistogramMethod = CardDetectionHistogramMethods.Chi_Square; EnableDoubleChecking = true; + EnforceBarcodeDetection = true; } } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp Binary files differindex 174d2d549..25b523e58 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp +++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h index 86d44ca34..90f3239be 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h +++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h @@ -17,6 +17,7 @@ namespace Tango property double SimilarityTolerance; property int HistogramMethod; property bool EnableDoubleChecking; + property bool EnforceBarcodeDetection; }; } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App_Start/WebApiConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/App_Start/WebApiConfig.cs index a7e994f9c..f3519205b 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App_Start/WebApiConfig.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App_Start/WebApiConfig.cs @@ -16,7 +16,7 @@ namespace Tango.TCC.Service config.Routes.MapHttpRoute( name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", + routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs index b3a4d4808..eb4600788 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs @@ -1,28 +1,52 @@ using Google.Protobuf; using System; using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; using System.Linq; using System.Net; using System.Net.Http; +using System.Security.Authentication; using System.Web.Http; using Tango.PMR.TCC; using Tango.TCC.BL; using Tango.TCC.BL.Web; +using Tango.TCC.Service.Filters; +using Tango.TCC.Service.Security; using Tango.Web.Controllers; +using Tango.Web.Security; namespace Tango.TCC.Service.Controllers { - public class ColorDetectionController : TangoController + public class ColorDetectionController : TangoController<TokenObject> { [HttpPost] public LoginResponse Login(LoginRequest request) { - return new LoginResponse(); + LoginResponse response = new LoginResponse(); + + if (request.AppID == TCCServiceConfig.APP_ID) + { + response.AccessToken = WebToken<TokenObject>.CreateNew(TCCServiceConfig.JWT_TOKEN_SECRET, new TokenObject() + { + DeviceID = request.DeviceID, + }).AccessToken; + } + else + { + throw new AuthenticationException("Invalid application ID provided."); + } + + return response; } + [JwtTokenFilter] [HttpPost] public DefinitionResponse GetDefinition(DefinitionRequest request) { + String s = RequestToken.Object.DeviceID; + return new DefinitionResponse() { TemplateString = TCCServiceConfig.TEMPLATE_STRING, @@ -33,6 +57,7 @@ namespace Tango.TCC.Service.Controllers HistogramMethod = TCCServiceConfig.HISTOGRAM_METHOD, SimilarityTolerance = TCCServiceConfig.SIMILARITY_TOLERANCE, EnableDoubleChecking = TCCServiceConfig.ENABLE_DOUBLE_CHECKING, + EnforceBarcodeDetection = TCCServiceConfig.ENFORCE_BARCODE_DETECTION, }; } @@ -41,6 +66,26 @@ namespace Tango.TCC.Service.Controllers { byte[] bitmapBytes = Convert.FromBase64String(request.BitmapString); + using (MemoryStream ms = new MemoryStream(bitmapBytes)) + { + using (Bitmap bmp = new Bitmap(ms)) + { + if (bmp.PixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb) + { + using (Bitmap bmp24 = bmp.ConvertTo24Bit()) + { + using (MemoryStream outms = new MemoryStream()) + { + bmp24.Save(outms, ImageFormat.Bmp); + bitmapBytes = outms.ToArray(); + + String base64 = Convert.ToBase64String(bitmapBytes); + } + } + } + } + } + using (ColorDetector detector = new ColorDetector()) { var output = detector.Detect(new DetectionInput() diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Filters/JwtTokenFilter.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Filters/JwtTokenFilter.cs new file mode 100644 index 000000000..d68a11ac3 --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Filters/JwtTokenFilter.cs @@ -0,0 +1,61 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Security.Authentication; +using System.Web; +using System.Web.Http; +using System.Web.Http.Controllers; +using System.Web.Http.Filters; +using Tango.Transport.Web; +using Tango.Web.Security; + +namespace Tango.TCC.Service.Filters +{ + public class JwtTokenFilter : ActionFilterAttribute + { + public bool AllowExpired { get; private set; } + + public JwtTokenFilter() + { + + } + + public JwtTokenFilter(bool allowExpired) + { + AllowExpired = allowExpired; + } + + public override void OnActionExecuting(HttpActionContext actionContext) + { + var authorizationHeader = actionContext.Request.Headers.Authorization; + + if (authorizationHeader != null) + { + try + { + WebToken.Validate(TCCServiceConfig.JWT_TOKEN_SECRET, authorizationHeader.Parameter != null ? authorizationHeader.Parameter : authorizationHeader.ToString()); + } + catch (JWT.TokenExpiredException) + { + if (!AllowExpired) + { + throw new TokenExpiredException("Token expired."); + } + } + catch (JWT.SignatureVerificationException) + { + throw new InvalidTokenException("Invalid token."); + } + } + else + { + throw new AuthenticationException("No token specified."); + } + + base.OnActionExecuting(actionContext); + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Security/TokenObject.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Security/TokenObject.cs new file mode 100644 index 000000000..545688451 --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Security/TokenObject.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Tango.TCC.Service.Security +{ + public class TokenObject + { + public String DeviceID { get; set; } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs index 8bedaefe9..14e9ef8cc 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs @@ -68,6 +68,11 @@ namespace Tango.TCC.Service public static bool ENABLE_DOUBLE_CHECKING => bool.Parse(ConfigurationManager.AppSettings[nameof(ENABLE_DOUBLE_CHECKING)].ToString()); /// <summary> + /// Gets a value indicating whether the card will be detected only when barcode detection is successful. + /// </summary> + public static bool ENFORCE_BARCODE_DETECTION => bool.Parse(ConfigurationManager.AppSettings[nameof(ENFORCE_BARCODE_DETECTION)].ToString()); + + /// <summary> /// Gets the mobile application ID. /// </summary> public static String APP_ID => ConfigurationManager.AppSettings[nameof(APP_ID)].ToString(); diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj index 78e13e6d4..f5ec44630 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj @@ -55,6 +55,9 @@ <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> + <Reference Include="JWT, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\JWT.5.0.0\lib\net46\JWT.dll</HintPath> + </Reference> <Reference Include="Microsoft.CSharp" /> <Reference Include="System" /> <Reference Include="System.Data" /> @@ -194,10 +197,12 @@ <Compile Include="Controllers\ColorDetectionController.cs" /> <Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\ValuesController.cs" /> + <Compile Include="Filters\JwtTokenFilter.cs" /> <Compile Include="Global.asax.cs"> <DependentUpon>Global.asax</DependentUpon> </Compile> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Security\TokenObject.cs" /> <Compile Include="TCCServiceConfig.cs" /> </ItemGroup> <ItemGroup> @@ -261,6 +266,10 @@ <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> <Name>Tango.PMR</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Web\Tango.Web.csproj"> <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> <Name>Tango.Web</Name> @@ -309,8 +318,7 @@ <Error Condition="!Exists('..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> </Target> <PropertyGroup> - <PostBuildEvent> - </PostBuildEvent> + <PostBuildEvent>del $(TargetDir)Tango.TCC.CardDetector.dll</PostBuildEvent> </PropertyGroup> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config index d2433dc9b..9ef7bc67d 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config @@ -29,7 +29,7 @@ <add key="CARD_COLUMNS" value="10" /> <add key="CARD_ROWS" value="11" /> - <add key="CARD_TARGET_INDEX" value="99" /> + <add key="CARD_TARGET_INDEX" value="89" /> <add key="TEMPLATE_STRING" value="PUT TEMPLATE STRING HERE!" /> <add key="SAMPLE_WIDTH" value="300" /> <add key="SAMPLE_HEIGHT" value="330" /> @@ -38,12 +38,15 @@ <add key="SIMILARITY_TOLERANCE" value="50" /> <add key="HISTOGRAM_METHOD" value="Chi_Square" /> <add key="ENABLE_DOUBLE_CHECKING" value="True" /> + <add key="ENFORCE_BARCODE_DETECTION" value="True" /> <add key="APP_ID" value="Tdf793i4ughsiduf8749509237885ehgfdlkghlT" /> </appSettings> <system.web> - <compilation debug="true" targetFramework="4.6.1" /> + <compilation debug="true" targetFramework="4.6.1"> + + </compilation> <httpRuntime targetFramework="4.6.1" maxRequestLength="4096" /> <httpModules> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config index 115c40d26..39d7af46a 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config @@ -5,6 +5,7 @@ <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" /> <package id="jQuery" version="3.3.1" targetFramework="net461" /> + <package id="JWT" version="5.0.0" targetFramework="net461" /> <package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net461" /> <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net461" /> <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.5.1" targetFramework="net461" /> diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs index 3cca605e9..34e3d9ea2 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/BitmapExtensions.cs @@ -20,5 +20,13 @@ public static class BitmapExtensions var encParams = new EncoderParameters() { Param = new[] { new EncoderParameter(Encoder.Quality, quality) } }; bitmap.Save(filePath, encoder, encParams); } + + public static Bitmap ConvertTo24Bit(this Bitmap bitmap) + { + var bmp = new Bitmap(bitmap.Width, bitmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + using (var gr = Graphics.FromImage(bmp)) + gr.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); + return bmp; + } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService/MachineStudio_Controller_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService/MachineStudio_Controller_TST.cs index d4585388a..e30cd6d77 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService/MachineStudio_Controller_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService/MachineStudio_Controller_TST.cs @@ -22,14 +22,14 @@ namespace Tango.UnitTesting.MachineService IWebTransportClient client = new WebTransportClient(); - var res1 = client.PostJson<LoginRequest, LoginResponse>($"{address}/api/MachineStudio/Login", new LoginRequest() - { - Email = "TestUser@twine-s.com", - Password = "ASJH_asdjkl1234", - Version = "1.0.0.0" - }).Result; + //var res1 = client.PostJson<LoginRequest, LoginResponse>($"{address}/api/MachineStudio/Login", new LoginRequest() + //{ + // Email = "TestUser@twine-s.com", + // Password = "ASJH_asdjkl1234", + // Version = "1.0.0.0" + //}).Result; - String token = res1.AccessToken; + String token = "1234"; client.AuthenticationToken = token; var res2 = client.PostJson<CheckForUpdatesRequest, CheckForUpdatesResponse>($"{address}/api/MachineStudio/CheckForUpdates", new CheckForUpdatesRequest() diff --git a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs index 32cc3f83c..5d96a7249 100644 --- a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs +++ b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs @@ -109,11 +109,11 @@ namespace Tango.Web.Controllers var authorizationHeader = request.Headers.Authorization; - if (authorizationHeader != null && authorizationHeader.Parameter != null) + if (authorizationHeader != null) { try { - RequestToken = WebToken<T>.FromToken(authorizationHeader.Parameter); + RequestToken = WebToken<T>.FromToken(authorizationHeader.Parameter != null ? authorizationHeader.Parameter : authorizationHeader.ToString()); } catch (Exception ex) { diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 399ca9aa7..2dc6e80b2 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -124,8 +124,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.Updater EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.ILMerge.UI", "Utilities\Tango.ILMerge.UI\Tango.ILMerge.UI.csproj", "{9A477128-25A1-4B27-AAAB-7421F8ED2B9D}" EndProject -Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Tango.Stubs.Installer", "Utilities\Tango.Stubs.Installer\Tango.Stubs.Installer.vdproj", "{6B399B28-83AE-4AD2-8438-25799B65086F}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Embroidery", "Embroidery", "{34839F9A-61D3-4ED3-B3F7-7DA3424CB0B6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEmbroidery", "Embroidery\project-files\visualstudio\libEmbroideryVS2008.vcxproj", "{BD30C7BD-9230-4ED7-B581-11F14041909D}" @@ -2272,31 +2270,6 @@ Global {9A477128-25A1-4B27-AAAB-7421F8ED2B9D}.Release|x64.Build.0 = Release|Any CPU {9A477128-25A1-4B27-AAAB-7421F8ED2B9D}.Release|x86.ActiveCfg = Release|Any CPU {9A477128-25A1-4B27-AAAB-7421F8ED2B9D}.Release|x86.Build.0 = Release|Any CPU - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|Any CPU.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|Any CPU.Build.0 = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|ARM.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|ARM.Build.0 = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|ARM64.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|ARM64.Build.0 = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|x64.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|x64.Build.0 = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|x86.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.AppVeyor|x86.Build.0 = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.Debug|Any CPU.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.Debug|ARM.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.Debug|ARM64.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.Debug|x64.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.Debug|x86.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.DefaultBuild|Any CPU.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.DefaultBuild|ARM.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.DefaultBuild|ARM64.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.DefaultBuild|x64.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.DefaultBuild|x86.ActiveCfg = Debug - {6B399B28-83AE-4AD2-8438-25799B65086F}.Release|Any CPU.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.Release|ARM.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.Release|ARM64.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.Release|x64.ActiveCfg = Release - {6B399B28-83AE-4AD2-8438-25799B65086F}.Release|x86.ActiveCfg = Release {BD30C7BD-9230-4ED7-B581-11F14041909D}.AppVeyor|Any CPU.ActiveCfg = Release|Win32 {BD30C7BD-9230-4ED7-B581-11F14041909D}.AppVeyor|Any CPU.Build.0 = Release|Win32 {BD30C7BD-9230-4ED7-B581-11F14041909D}.AppVeyor|ARM.ActiveCfg = Release|Win32 @@ -5302,7 +5275,6 @@ Global {FC337A7F-1214-41D8-9992-78092A3B961E} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} {844787CE-F409-4F18-BCCC-F3809ECB86F3} = {57DF2A95-5DDD-4830-A4AF-B484B59C7C2B} {9A477128-25A1-4B27-AAAB-7421F8ED2B9D} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} - {6B399B28-83AE-4AD2-8438-25799B65086F} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {BD30C7BD-9230-4ED7-B581-11F14041909D} = {34839F9A-61D3-4ED3-B3F7-7DA3424CB0B6} {0565AEEC-ED1B-4F0E-A277-D33F852207BC} = {34839F9A-61D3-4ED3-B3F7-7DA3424CB0B6} {69DB0564-268C-4B3C-B5D6-A3CDC7D14EAE} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} @@ -5366,12 +5338,12 @@ Global {B0EFE7A0-7039-4DC4-8B39-465E521299F6} = {3D750293-C243-48F6-9112-A6B3FF650C0D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - BuildVersion_UseGlobalSettings = False - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs - BuildVersion_StartDate = 2000/1/1 - BuildVersion_UpdateFileVersion = False - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_UpdateFileVersion = False + BuildVersion_StartDate = 2000/1/1 + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_UseGlobalSettings = False EndGlobalSection EndGlobal |
