Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. MVVM architecture for a Hardware based application

MVVM architecture for a Hardware based application

Scheduled Pinned Locked Moved Design and Architecture
wpfarchitecturecsharphardwareregex
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Praveen Raghuvanshi
    wrote on last edited by
    #1

    Hi, I need to architecture a WPF application that will interact with Hardware device(s). I am planning to use MVVM architectural pattern and DI in order to provide modularity. Here are the components of it. Suppose we have a Hardware called as 'Car'. There can be different type(s) of Car such as Ford, GM, Skoda etc. The Cars will have features. Some of them are common to all the cars and some are specific to the Make and model. Common features can be - 4 wheels, engine, steering etc. Different features: Ford - Music system, Auto lock etc. GM - Automatic transmission, Power steering etc. Skoda - Airbags, Antilock breaking system(ABS) etc. Application should load screen according to the car. The hardware will interact through a set of commands. Each type of hardware will have their set of commands. For E.g: Suppose total we have 50 commands for the all the types. Supported commands by each type: Ford - 30 out of 50 GM - 40 out of 50 Skoda - 20 out of 50. I am planning to architect as shown below. - An abstract class for the Car to interact with the hardware which will be a Model. - Each type of Hardware/car will be another Model. - There will be View-Model for each type of Car(Ford, GM and Skoda). We can have VM for different make of cars, if required. - Similar to View-Model, we'll have Views(Screns). I need to architect the Hardware Abstraction Layer(HAL). By HAL, i mean to say a layer which will interact with the Hardware and should be extensible. So, in future if a new type of car comes, interaction with View-Models and Views should not change. The HAL will be responsible of sending/receiving the commands. A small representation of the MVVM architecutre will be as follows. ----------------- | Car View | ----------------- | |---------------|-------------| ---------------- ----------- ------------ | Ford View | | GM View | | Skoda View | ---------------- ----------- ------------ ----------------- | Car ViewModel | ----------------- | |-----------------------|-------------| ----------------- -------------- ----------------- | Ford ViewModel | | GM ViewModel | | Skoda ViewModel | ----------------- -------------- ----------------- ------------ | Car Model | ------------ | |-----------|------------------| -------------- ---------- -------------- | Ford Model | | GM Model | | Skoda Model | -------------- ---------- --------------

    J D J 3 Replies Last reply
    0
    • P Praveen Raghuvanshi

      Hi, I need to architecture a WPF application that will interact with Hardware device(s). I am planning to use MVVM architectural pattern and DI in order to provide modularity. Here are the components of it. Suppose we have a Hardware called as 'Car'. There can be different type(s) of Car such as Ford, GM, Skoda etc. The Cars will have features. Some of them are common to all the cars and some are specific to the Make and model. Common features can be - 4 wheels, engine, steering etc. Different features: Ford - Music system, Auto lock etc. GM - Automatic transmission, Power steering etc. Skoda - Airbags, Antilock breaking system(ABS) etc. Application should load screen according to the car. The hardware will interact through a set of commands. Each type of hardware will have their set of commands. For E.g: Suppose total we have 50 commands for the all the types. Supported commands by each type: Ford - 30 out of 50 GM - 40 out of 50 Skoda - 20 out of 50. I am planning to architect as shown below. - An abstract class for the Car to interact with the hardware which will be a Model. - Each type of Hardware/car will be another Model. - There will be View-Model for each type of Car(Ford, GM and Skoda). We can have VM for different make of cars, if required. - Similar to View-Model, we'll have Views(Screns). I need to architect the Hardware Abstraction Layer(HAL). By HAL, i mean to say a layer which will interact with the Hardware and should be extensible. So, in future if a new type of car comes, interaction with View-Models and Views should not change. The HAL will be responsible of sending/receiving the commands. A small representation of the MVVM architecutre will be as follows. ----------------- | Car View | ----------------- | |---------------|-------------| ---------------- ----------- ------------ | Ford View | | GM View | | Skoda View | ---------------- ----------- ------------ ----------------- | Car ViewModel | ----------------- | |-----------------------|-------------| ----------------- -------------- ----------------- | Ford ViewModel | | GM ViewModel | | Skoda ViewModel | ----------------- -------------- ----------------- ------------ | Car Model | ------------ | |-----------|------------------| -------------- ---------- -------------- | Ford Model | | GM Model | | Skoda Model | -------------- ---------- --------------

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      Praveen Raghuvanshi wrote:

      I am thinking of having each type of car as a Module

      I would call it an adapter but yes that is it.

      Praveen Raghuvanshi wrote:

      2- How can we bring modularity

      By using adapters.

      Praveen Raghuvanshi wrote:

      4- How does the interaction between different objects take place in a loosely coupled manner?

      Huh? Which "objects" do you think are interacting?

      Praveen Raghuvanshi wrote:

      5- I'll be using Microsft Ribbon. How can we have interaction between different buttons in the Ribbon and modules or screens?

      That isn't really a architecture question. And obviously if you want to look at that the first step would be to look at the API and figure out how it works and THEN attempt to answer your question.

      Praveen Raghuvanshi wrote:

      Please let me know if any other information is required

      Figuring out exactly how and what you are going to persistence is going to be a significant problem.

      1 Reply Last reply
      0
      • P Praveen Raghuvanshi

        Hi, I need to architecture a WPF application that will interact with Hardware device(s). I am planning to use MVVM architectural pattern and DI in order to provide modularity. Here are the components of it. Suppose we have a Hardware called as 'Car'. There can be different type(s) of Car such as Ford, GM, Skoda etc. The Cars will have features. Some of them are common to all the cars and some are specific to the Make and model. Common features can be - 4 wheels, engine, steering etc. Different features: Ford - Music system, Auto lock etc. GM - Automatic transmission, Power steering etc. Skoda - Airbags, Antilock breaking system(ABS) etc. Application should load screen according to the car. The hardware will interact through a set of commands. Each type of hardware will have their set of commands. For E.g: Suppose total we have 50 commands for the all the types. Supported commands by each type: Ford - 30 out of 50 GM - 40 out of 50 Skoda - 20 out of 50. I am planning to architect as shown below. - An abstract class for the Car to interact with the hardware which will be a Model. - Each type of Hardware/car will be another Model. - There will be View-Model for each type of Car(Ford, GM and Skoda). We can have VM for different make of cars, if required. - Similar to View-Model, we'll have Views(Screns). I need to architect the Hardware Abstraction Layer(HAL). By HAL, i mean to say a layer which will interact with the Hardware and should be extensible. So, in future if a new type of car comes, interaction with View-Models and Views should not change. The HAL will be responsible of sending/receiving the commands. A small representation of the MVVM architecutre will be as follows. ----------------- | Car View | ----------------- | |---------------|-------------| ---------------- ----------- ------------ | Ford View | | GM View | | Skoda View | ---------------- ----------- ------------ ----------------- | Car ViewModel | ----------------- | |-----------------------|-------------| ----------------- -------------- ----------------- | Ford ViewModel | | GM ViewModel | | Skoda ViewModel | ----------------- -------------- ----------------- ------------ | Car Model | ------------ | |-----------|------------------| -------------- ---------- -------------- | Ford Model | | GM Model | | Skoda Model | -------------- ---------- --------------

        D Offline
        D Offline
        dusty_dex
        wrote on last edited by
        #3

        Maybe you are already aware of ivi-systems, but you ought to check for existing efforts. in-vehicle-infotainment-summit :)

        1 Reply Last reply
        0
        • P Praveen Raghuvanshi

          Hi, I need to architecture a WPF application that will interact with Hardware device(s). I am planning to use MVVM architectural pattern and DI in order to provide modularity. Here are the components of it. Suppose we have a Hardware called as 'Car'. There can be different type(s) of Car such as Ford, GM, Skoda etc. The Cars will have features. Some of them are common to all the cars and some are specific to the Make and model. Common features can be - 4 wheels, engine, steering etc. Different features: Ford - Music system, Auto lock etc. GM - Automatic transmission, Power steering etc. Skoda - Airbags, Antilock breaking system(ABS) etc. Application should load screen according to the car. The hardware will interact through a set of commands. Each type of hardware will have their set of commands. For E.g: Suppose total we have 50 commands for the all the types. Supported commands by each type: Ford - 30 out of 50 GM - 40 out of 50 Skoda - 20 out of 50. I am planning to architect as shown below. - An abstract class for the Car to interact with the hardware which will be a Model. - Each type of Hardware/car will be another Model. - There will be View-Model for each type of Car(Ford, GM and Skoda). We can have VM for different make of cars, if required. - Similar to View-Model, we'll have Views(Screns). I need to architect the Hardware Abstraction Layer(HAL). By HAL, i mean to say a layer which will interact with the Hardware and should be extensible. So, in future if a new type of car comes, interaction with View-Models and Views should not change. The HAL will be responsible of sending/receiving the commands. A small representation of the MVVM architecutre will be as follows. ----------------- | Car View | ----------------- | |---------------|-------------| ---------------- ----------- ------------ | Ford View | | GM View | | Skoda View | ---------------- ----------- ------------ ----------------- | Car ViewModel | ----------------- | |-----------------------|-------------| ----------------- -------------- ----------------- | Ford ViewModel | | GM ViewModel | | Skoda ViewModel | ----------------- -------------- ----------------- ------------ | Car Model | ------------ | |-----------|------------------| -------------- ---------- -------------- | Ford Model | | GM Model | | Skoda Model | -------------- ---------- --------------

          J Offline
          J Offline
          Jonathan Davies
          wrote on last edited by
          #4

          Questions: 1- What could be the best way to architect such an application? Don't know particularly but whatever method you use do it thoughly Consider your hardware being on a broadcast bus 2- How can we bring modularity? First define what you mean by a module, h/w and s/w engineers have different ideas of what a module is I asked this on one project and the best answer I got was 'lego-like' - because it was on a project poster. Once this was defined things started happening. 3- How can we bring extensiblity? Again define it: work through a use case as to how you would extend the system. does a maintenance technician take a new module and just plug it in? does it then need new software installed to accept new hardware or will the hardware deliver it or say where to get it etc 4- How does the interaction between different objects take place in a loosely coupled manner? One possibility: Set up a message passing mechanism between objects and use a setup phase: i.e. Tell Module A to do Task1 when it gets Message 1 and then send out Message 2 (but not till it's told to) Tell Module B to do Task2 when it gets message 2 and then send out Message 3 and an execution phase: Send Message 1 to Module A and wait for Message 2 from Module 2 to show completion. 5- I'll be using Microsft Ribbon. How can we have interaction between different buttons in the Ribbon and modules or screens? Don't know offhand 6- Any nice article/case study/link to understand the architecure. Look at http://en.wikipedia.org/wiki/CAN_Kingdom[^] described in more detail http://www.kvaser.com/images/Papers/ck301p.pdf[^]. The principles here allowed me to take a non-functioning 'modular' system and make it modular, extendable and above all work.

          P 1 Reply Last reply
          0
          • J Jonathan Davies

            Questions: 1- What could be the best way to architect such an application? Don't know particularly but whatever method you use do it thoughly Consider your hardware being on a broadcast bus 2- How can we bring modularity? First define what you mean by a module, h/w and s/w engineers have different ideas of what a module is I asked this on one project and the best answer I got was 'lego-like' - because it was on a project poster. Once this was defined things started happening. 3- How can we bring extensiblity? Again define it: work through a use case as to how you would extend the system. does a maintenance technician take a new module and just plug it in? does it then need new software installed to accept new hardware or will the hardware deliver it or say where to get it etc 4- How does the interaction between different objects take place in a loosely coupled manner? One possibility: Set up a message passing mechanism between objects and use a setup phase: i.e. Tell Module A to do Task1 when it gets Message 1 and then send out Message 2 (but not till it's told to) Tell Module B to do Task2 when it gets message 2 and then send out Message 3 and an execution phase: Send Message 1 to Module A and wait for Message 2 from Module 2 to show completion. 5- I'll be using Microsft Ribbon. How can we have interaction between different buttons in the Ribbon and modules or screens? Don't know offhand 6- Any nice article/case study/link to understand the architecure. Look at http://en.wikipedia.org/wiki/CAN_Kingdom[^] described in more detail http://www.kvaser.com/images/Papers/ck301p.pdf[^]. The principles here allowed me to take a non-functioning 'modular' system and make it modular, extendable and above all work.

            P Offline
            P Offline
            Praveen Raghuvanshi
            wrote on last edited by
            #5

            Appreciate your inputs! I'll check on them.

            Praveen Raghuvanshi Software Developer

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups