Révision 60882b56

Voir les différences:

TestBLE/TestBLE.Android/obj/Debug/110/_TelemetryProps
22 22
AndroidDexTool=d8
23 23
AndroidLinkTool=
24 24
AndroidEnableProfiledAot=
25
AndroidInstallAfterBuild=True
26
AndroidSessionId=bd18f6e1-ac31-4cd1-a87a-7f35fc9fe283
25
AndroidInstallAfterBuild=False
26
AndroidSessionId=
27 27
BuildConfiguration=Debug
28 28
TemplateName={c9e5eea5-ca05-42a1-839b-61506e0a37df}
TestBLE/TestBLE/Models/TeoBluetoothCommands.cs
11 11
            // Voir documentation TEO INRAE 
12 12
            // Codes ASCII
13 13
            ModeOrdre,
14
            EmissionPoids,
14 15
            SortieOrdreGardeBluetooth,
15 16
            SortieOrdreEtBluetooth,
16 17
            ModePeseeSimple,
......
22 23
            ZeroP1,
23 24
            ZeroP2,
24 25
            InfosMetrologie,
25
            EmissionPoids
26 26
        }
27 27

  
28 28
        // Retourne la chaine d'octets d'une commande Teo (prog INRAE)
TestBLE/TestBLE/Models/WeightingResponse.cs
22 22
            set { trayType = value; }
23 23
        }
24 24

  
25
        private int myVar;
25
        private int measuredWeight;
26 26

  
27
        public int MyProperty
27
        public int MeasuredWeight
28 28
        {
29
            get { return myVar; }
30
            set { myVar = value; }
29
            get { return measuredWeight; }
30
            set { measuredWeight = value; }
31 31
        }
32 32

  
33
        private bool isNegative;
33 34

  
35
        public bool IsNegative
36
        {
37
            get { return isNegative; }
38
            set { isNegative = value; }
39
        }
34 40

  
41
        public WeightingResponse(string data)
42
        {
43

  
44
        }
35 45
    }
36 46
}
TestBLE/TestBLE/ViewModels/CommandItemViewModel.cs
13 13
        private string name;
14 14
        private TeoBluetoothCommand.CommandType toSendCommand;
15 15

  
16
        public TeoBluetoothCommand.CommandType ToSendCommand
16
        private string commandBytes;
17

  
18
        public string CommandBytes
17 19
        {
18
            get { return toSendCommand; }
19
            set { SetProperty( ref toSendCommand, value); }
20
            get { return commandBytes; }
21
            set { SetProperty( ref commandBytes, value); }
20 22
        }
21 23

  
22 24
        public string Name
......
25 27
            set { SetProperty(ref name, value); }
26 28
        }
27 29

  
30
        public TeoBluetoothCommand.CommandType ToSendCommand
31
        {
32
            get { return toSendCommand; }
33
            set { SetProperty( ref toSendCommand, value); }
34
        }
35

  
28 36
        private async Task<bool> SendValue()
29 37
        {
30 38
            await BluetoothService.SendHexValues(TeoBluetoothCommand.GetCommandCode(ToSendCommand));
......
35 43

  
36 44
        public CommandItemViewModel(TeoBluetoothCommand.CommandType cmd)
37 45
        {
46
            ToSendCommand = cmd;
38 47
            Name = TeoBluetoothCommand.GetCommandName(cmd);
48
            CommandBytes = TeoBluetoothCommand.GetCommandCode(cmd).ToString();
39 49
            BluetoothService = DependencyService.Get<IBluetoothService>();
40 50
            SendValueCommand = new Command(async () => await SendValue());
41 51
        }
TestBLE/TestBLE/ViewModels/DeviceViewModel.cs
66 66

  
67 67
            // Ajout manuel des commandes
68 68
            AvailableCommandsList = new ObservableCollection<CommandItemViewModel>();
69
            foreach (CommandType _cmd in Enum.GetValues(typeof(CommandType))
69
            foreach (CommandType _cmd in Enum.GetValues(typeof(CommandType)))
70 70
            {
71

  
71
                AvailableCommandsList.Add(new CommandItemViewModel(_cmd));
72 72
            }
73 73
        }
74 74

  
TestBLE/TestBLE/Views/DeviceView.xaml
6 6
    xmlns:xe="clr-namespace:XamEffects;assembly=XamEffects"
7 7
    Title="Device Page">
8 8
    <ContentPage.Content>
9
        <StackLayout BackgroundColor="#001729" VerticalOptions="FillAndExpand">
9

  
10
        <StackLayout
11
            Padding="10"
12
            BackgroundColor="#001729"
13
            VerticalOptions="FillAndExpand">
10 14
            <StackLayout VerticalOptions="CenterAndExpand">
11 15
                <Frame
12 16
                    Padding="0"
......
16 20
                    HasShadow="False"
17 21
                    HorizontalOptions="Center"
18 22
                    VerticalOptions="CenterAndExpand"
19
                    WidthRequest="200">
23
                    WidthRequest="250">
20 24
                    <StackLayout Spacing="0">
21 25
                        <StackLayout Margin="0,10">
22 26
                            <Label
......
59 63
                            HorizontalOptions="FillAndExpand"
60 64
                            IsVisible="{Binding IsConnected}"
61 65
                            Color="#4f5a64" />
62
                        <StackLayout
63
                            x:Name="commandsList"
64
                            Margin="0,10"
65
                            Padding="0"
66
                            BindableLayout.ItemsSource="{Binding AvailableCommandsList}"
67
                            HorizontalOptions="FillAndExpand"
68
                            IsVisible="{Binding IsConnected}"
69
                            Orientation="Vertical"
70
                            Spacing="0">
71
                            <BindableLayout.ItemTemplate>
72
                                <DataTemplate>
73
                                    <StackLayout
74
                                        Padding="0,5"
75
                                        xe:Commands.Tap="{Binding SendValueCommand}"
76
                                        xe:TouchEffect.Color="#34a9ff"
77
                                        Spacing="0">
78
                                        <Label
79
                                            FontAttributes="Bold"
80
                                            HorizontalTextAlignment="Center"
81
                                            Text="{Binding Name}"
82
                                            TextColor="White" />
83
                                    </StackLayout>
84
                                </DataTemplate>
85
                            </BindableLayout.ItemTemplate>
86
                        </StackLayout>
66
                        <ScrollView Padding="0,10" IsVisible="{Binding IsConnected}">
67
                            <StackLayout
68
                                x:Name="commandsList"
69
                                Padding="0"
70
                                BindableLayout.ItemsSource="{Binding AvailableCommandsList}"
71
                                HorizontalOptions="FillAndExpand"
72
                                Orientation="Vertical"
73
                                Spacing="4">
74
                                <BindableLayout.ItemTemplate>
75
                                    <DataTemplate>
76
                                        <StackLayout
77
                                            Padding="0,5"
78
                                            xe:Commands.Tap="{Binding SendValueCommand}"
79
                                            xe:TouchEffect.Color="#34a9ff"
80
                                            Spacing="0">
81
                                            <Label
82
                                                FontAttributes="Bold"
83
                                                HorizontalTextAlignment="Center"
84
                                                Text="{Binding Name}"
85
                                                TextColor="White" />
86
                                            <Label
87
                                                FontAttributes="Italic"
88
                                                HorizontalTextAlignment="Center"
89
                                                Text="{Binding CommandBytes}"
90
                                                TextColor="DarkGray" />
91
                                        </StackLayout>
92
                                    </DataTemplate>
93
                                </BindableLayout.ItemTemplate>
94
                            </StackLayout>
87 95

  
96
                        </ScrollView>
88 97
                    </StackLayout>
89 98

  
90 99
                </Frame>

Formats disponibles : Unified diff