-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renamed adapter state classes; moved smapleapp dir; added logo
- Loading branch information
Malachi Griffie
committed
Mar 31, 2017
1 parent
956aae4
commit 669b3e1
Showing
67 changed files
with
465 additions
and
521 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// Copyright Malachi Griffie | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Acr.UserDialogs; | ||
using Android.App; | ||
using Android.Content; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
using Android.Runtime; | ||
using nexus.core; | ||
using nexus.core.logging; | ||
using nexus.protocols.ble; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Platform.Android; | ||
using Application = Android.App.Application; | ||
using Log = Android.Util.Log; | ||
|
||
namespace ble.net.sampleapp.android | ||
{ | ||
[Application( Debuggable = IS_DEBUG, AllowBackup = true, AllowClearUserData = true )] | ||
public class MyApplication : Application | ||
{ | ||
public const Boolean IS_DEBUG = | ||
#if DEBUG | ||
true; | ||
#else | ||
false; | ||
#endif | ||
|
||
protected MyApplication( IntPtr javaReference, JniHandleOwnership transfer ) | ||
: base( javaReference, transfer ) | ||
{ | ||
} | ||
|
||
public override void OnCreate() | ||
{ | ||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse | ||
// ReSharper disable once InvertIf | ||
if(IS_DEBUG) | ||
{ | ||
// | ||
// dump all entries to Android system log in debug mode | ||
// | ||
SystemLog.Instance.Id = Assembly.GetAssembly( GetType() ).GetName().Name; | ||
SystemLog.Instance.AddSink( | ||
entry => | ||
{ | ||
var message = entry.FormatMessageAndArguments() + " " + | ||
entry.Data.Select( x => x?.ToString() + "" ).Join( " " ); | ||
switch(entry.Severity) | ||
{ | ||
case LogLevel.Error: | ||
|
||
Log.Error( entry.LogId, message ); | ||
break; | ||
case LogLevel.Warn: | ||
Log.Warn( entry.LogId, message ); | ||
break; | ||
case LogLevel.Info: | ||
Log.Info( entry.LogId, message ); | ||
break; | ||
default: | ||
Log.Debug( entry.LogId, message ); | ||
break; | ||
} | ||
} ); | ||
} | ||
} | ||
} | ||
|
||
[Activity( Label = "BLE.net Sample App", Theme = "@style/MainTheme", MainLauncher = false, | ||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation )] | ||
public class MainActivity : FormsAppCompatActivity | ||
{ | ||
protected override void OnActivityResult( Int32 requestCode, Result resultCode, Intent data ) | ||
{ | ||
BluetoothLowEnergyAdapter.OnActivityResult( requestCode, resultCode, data ); | ||
} | ||
|
||
protected override void OnCreate( Bundle bundle ) | ||
{ | ||
TabLayoutResource = Resource.Layout.Tabbar; | ||
ToolbarResource = Resource.Layout.Toolbar; | ||
|
||
base.OnCreate( bundle ); | ||
|
||
BluetoothLowEnergyAdapter.Init( this ); | ||
UserDialogs.Init( this ); | ||
Forms.Init( this, bundle ); | ||
|
||
LoadApplication( | ||
new FormsApp( BluetoothLowEnergyAdapter.ObtainDefaultAdapter( ApplicationContext ), UserDialogs.Instance ) ); | ||
} | ||
} | ||
|
||
[Activity( Theme = "@style/MainTheme", MainLauncher = true, NoHistory = true )] | ||
public class SplashActivity : Activity | ||
{ | ||
protected override void OnCreate( Bundle bundle ) | ||
{ | ||
base.OnCreate( bundle ); | ||
StartActivity( typeof(MainActivity) ); | ||
Finish(); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright Malachi Griffie | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Acr.UserDialogs; | ||
using Foundation; | ||
using nexus.core; | ||
using nexus.core.logging; | ||
using nexus.protocols.ble; | ||
using UIKit; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Platform.iOS; | ||
|
||
namespace ble.net.sampleapp.ios | ||
{ | ||
public class MyApplication | ||
{ | ||
public const Boolean IS_DEBUG = | ||
#if DEBUG | ||
true; | ||
#else | ||
false; | ||
#endif | ||
|
||
internal static void Main( String[] args ) | ||
{ | ||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse | ||
if(IS_DEBUG) | ||
{ | ||
#pragma warning disable 162 | ||
SystemLog.Instance.Id = Assembly.GetAssembly( typeof(MyApplication) ).GetName().Name; | ||
SystemLog.Instance.AddSink( | ||
entry => | ||
{ | ||
var message = entry.FormatMessageAndArguments() + " " + | ||
entry.Data.Select( x => x?.ToString() + "" ).Join( " " ); | ||
if(entry.Severity == LogLevel.Error) | ||
{ | ||
Console.Error.WriteLine( message ); | ||
} | ||
else | ||
{ | ||
Console.Out.WriteLine( message ); | ||
} | ||
} ); | ||
#pragma warning restore 162 | ||
} | ||
|
||
UIApplication.Main( args, null, nameof( AppDelegate ) ); | ||
} | ||
} | ||
|
||
[Register( "AppDelegate" )] | ||
public class AppDelegate : FormsApplicationDelegate | ||
{ | ||
public override Boolean FinishedLaunching( UIApplication app, NSDictionary options ) | ||
{ | ||
Forms.Init(); | ||
LoadApplication( new FormsApp( BluetoothLowEnergyAdapter.ObtainDefaultAdapter(), UserDialogs.Instance ) ); | ||
return base.FinishedLaunching( app, options ); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.